/**
  * @param $lectureId
  * @param BreakInputModel $model
  * @return View
  * @throws \Exception
  * @Validatetoken('token')
  * @Method('GET', 'POST')
  * @Route('lectures/{integer $lectureId}/addbreak')
  */
 public function addBreak(BreakInputModel $model, integer $lectureId)
 {
     if (!$model->isValid()) {
         return new View('Lectures', 'addbreak', $model);
     }
     $service = new LecturesService($this->dbContext);
     if (HttpContext::getInstance()->isPost()) {
         $response = $service->addBreak($model);
         if ($response->hasError()) {
             if ($response->getErrorCode() > 1) {
                 throw new \Exception($response->getMessage(), $response->getErrorCode());
             } else {
                 $this->addErrorMessage($response->getMessage());
                 $this->redirectToUrl('/conferences/details/' . $response->getModel());
             }
         } else {
             $this->addInfoMessage($response->getMessage());
             $this->redirectToUrl('/conferences/details/' . $response->getModel());
         }
     } else {
         $conferenceId = $this->dbContext->getLecturesRepository()->filterById(" = {$lectureId}")->findOne()->getConferenceId();
         $lecture = $this->dbContext->getLecturesRepository()->filterById(" = {$lectureId}")->findOne();
         $breakModel = new BreakInputModel();
         $breakModel->setLectureId($lectureId);
         $breakModel->setStartDate($lecture->getStartDate());
         $breakModel->setEndDate($lecture->getEndDate());
         $breakModel->setConferenceId($conferenceId);
         return new View('Lectures', 'addbreak', $breakModel);
     }
 }