function updateCategoryById($id)
{
    $app = \Slim\Slim::getInstance();
    try {
        $app->response->write(json_encode(CategoriesDAO::update($id, $app->request->getBody())));
        return json_encode($app->response->getBody());
    } catch (Exception $e) {
        $app->response->setStatus(404);
        $app->response->setBody(getErrorMessage($e));
        return json_encode($app->response->getBody());
    }
}