/**
  * @param Session $session
  */
 public function deleteAction(Session $session)
 {
     if ($session->getAccount() !== $this->securityContext->getAccount() && !$this->securityContext->hasRole('T3DD.Backend:Administrator')) {
         $this->response->setStatus(403);
         return;
     }
     foreach ($this->voteRepository->findBySession($session) as $vote) {
         $this->voteRepository->remove($vote);
     }
     $this->sessionRepository->remove($session);
     // TODO Fix redirect
     $this->redirect('index');
 }
 /**
  * @param \T3DD\Backend\Domain\Model\Session $session
  * @return void
  */
 protected function isValid($session)
 {
     if ($this->sessionRepository->countByTitle($session->getTitle())) {
         $this->addError('There is already a session with this title', 1424730006);
     }
 }