public function edit($id)
 {
     if ($this->shouldLockIfNoPermission('data.edit')) {
         return;
     }
     $eventService = new Event($this->db);
     if ($this->request->is('post')) {
         $postItem = array_filter(array_map('trim', $_POST), 'strlen');
         $valuesToUpdate = [];
         foreach (self::$tableColumns as $column) {
             if (isset($postItem[$column])) {
                 if ($column === 'created' || strpos($column, 'date_') === 0) {
                     $postItem[$column] = strtotime($postItem[$column]);
                 }
                 $valuesToUpdate[$column] = $postItem[$column];
             }
         }
         if (count($valuesToUpdate) > 0) {
             $eventService->updateById($id, $valuesToUpdate);
             $this->flash->success('Updated event successfully!');
         } else {
             $this->flash->info('Nothing was updated.');
         }
         return $this->redirect('/events/view/' . $id);
     }
     $item = $eventService->findById($id);
     if ($item === null) {
         $this->flash->error('Unable to find event!');
         return $this->redirect('/events/calendar');
     }
     $item['created'] = $this->formatNullableDate($item['created']);
     $this->set('item', $item);
 }