public function delete()
 {
     if (!empty($_REQUEST['id'])) {
         try {
             $calendar = new AggregatedCalendar($_GET['id']);
             $aggregation_id = $calendar->getAggregation_id();
             $calendar->delete();
         } catch (\Exception $e) {
             $_SESSION['errorMessages'][] = $e;
         }
     }
     header('Location: ' . View::generateUrl('aggregations.view', ['id' => $aggregation_id]));
     exit;
 }
 public function sync()
 {
     if (!empty($_REQUEST['id'])) {
         try {
             $a = new Aggregation($_REQUEST['id']);
             $a->sync();
             header('Location: ' . View::generateUrl('aggregations.view', ['id' => $a->getId()]));
             exit;
         } catch (\Exception $e) {
             $_SESSION['errorMessages'][] = $e;
         }
     }
     header('HTTP/1.1 404 Not Found', true, 404);
     $this->template->blocks[] = new Block('404.inc');
     return;
 }
 public function index()
 {
     header('Location: ' . View::generateUrl('aggregations.index'));
     exit;
 }