public function logout()
 {
     if ($this->isLogged()) {
         Session::unsetKey('id');
         RouteService::redirect('users', 'login', true);
     } else {
         RouteService::redirect('users', 'login', true);
     }
 }
 public function delete($id)
 {
     $this->authorize();
     if (!isset($id)) {
         RouteService::redirect('todos', '', true);
     }
     try {
         $todoModel = new TodoModel();
         $todoModel->delete(Session::get('id'), $id);
         RouteService::redirect('todos', '', true);
     } catch (\Exception $e) {
         RouteService::redirect('todos', '', true);
     }
 }
 protected function authorize()
 {
     if (!$this->isLogged()) {
         RouteService::redirect('users', 'login', true);
     }
 }