private static function updateTimezone(Timezone $tz)
 {
     $query = "UPDATE timezone SET name = :name, city = :city, utc_offset = :utc_offset\n                  WHERE id = :id";
     $params = array("id" => $tz->getId(), "name" => $tz->getName(), "city" => $tz->getCity(), "utc_offset" => $tz->getUtcOffset());
     $stmt = static::db()->prepare($query);
     $stmt->execute($params);
 }
 * Created by PhpStorm.
 * User: shannon
 * Date: 12/19/15
 * Time: 1:51 PM
 */
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Syndicate\Utils\RequestParser;
use Syndicate\Entities\Timezone;
use Syndicate\Entities\Session;
use Syndicate\Entities\Privilege;
use Syndicate\Repositories\TimezoneRepository;
$save_timezone = function (Request $request, Response $response) {
    $parser = new RequestParser($request);
    $data = $parser->getData();
    $timezone = new Timezone();
    $timezone->hydrate($data);
    $errors = $timezone->validateData();
    if (!empty($errors)) {
        $new_response = $response->withStatus(400);
        $r = array("errors" => $errors);
        $new_response->getBody()->write(json_encode($r));
        return $new_response;
    }
    TimezoneRepository::saveTimezone($timezone);
    $response->getBody()->write(json_encode($timezone));
    return $response;
};
$app->post("/timezone/save", $save_timezone);
$get_timezones = function (Request $request, Response $response) {
    $session = Session::getAuthenicatedSession();