$response->json($response);
} elseif ($route->match('iconimgupload', null)) {
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    $icon = $model->iconFind(array('id' => $api->getInputVal('id'), 'user_id' => $user->id));
    if (!$icon) {
        $response->status = 404;
        $response->message = 'Not found';
        $response->json($response);
    }
    $uploader = new Uploader();
    $uploader->setDir('storage/icons/');
    $uploader->setExtensions(array('png', 'jpg', 'gif'));
    //allowed extensions list//
    $uploader->setMaxSize(0.2);
    $uploader->setCustomName($icon->name . '-' . $api->getInputVal('id') . '-' . time());
    if (!$uploader->uploadFile('file')) {
        $response->status = 500;
        $response->message = $uploader->getMessage();
        $response->json($response);
    }
    $model->iconUpdate(array('icon' => $uploader->getUploadName(), 'updated_at' => date("Y-m-d H:i:s")), array('id' => $icon->id));
    $path = 'storage/icons/' . $api->getInputVal('current');
    if (is_file($path)) {
        unlink($path);
    }
    $response->data = array('icon' => $uploader->getUploadName());
    $response->json($response);
} elseif ($route->match('userread', null)) {
    // Prepare and sanitize post input
    $response->data = $model->userFind(array('id' => $user->id));