public function delete($id)
 {
     if ($this->shouldLockIfNoPermission('data.edit')) {
         return;
     }
     if ($this->request->is('post')) {
         $eventService = new Event($this->db);
         $event = $eventService->findById($id);
         $eventService->deleteById($id);
         $this->flash->success('Deleted event successfully!');
         if ($event !== null) {
             $endpoint = idate('m', $event['created']) . '/' . idate('Y', $event['created']);
             return $this->redirect('/events/calendar/' . $endpoint);
         }
         return $this->redirect('/events');
     }
     $this->set('id', $id);
 }