/**
  * @param VenueInputModel $model
  * @return ServiceResponse
  * @throws \Exception
  */
 public function addVenue(VenueInputModel $model) : ServiceResponse
 {
     $venue = new Venue($model->getTitle(), $model->getDescription(), $model->getAddress(), HttpContext::getInstance()->getIdentity()->getUserId());
     $this->dbContext->getVenuesRepository()->add($venue);
     $this->dbContext->saveChanges();
     $title = $model->getTitle();
     $owner = HttpContext::getInstance()->getIdentity()->getUsername();
     $message = "New conference titled '{$title}' was added by user {$owner}.";
     $notyService = new NotificationsService($this->dbContext);
     $notyService->postToAll($message);
     return new ServiceResponse(null, 'Venue added successfully.');
 }
 /**
  * @param VenueInputModel $model
  * @Validatetoken('token')
  * @return View
  */
 public function add(VenueInputModel $model) : View
 {
     if (!$model->isValid()) {
         return new View('venues', 'add', $model);
     }
     $service = new VenuesServices($this->dbContext);
     if (HttpContext::getInstance()->isPost()) {
         $result = $service->addVenue($model);
         if (!$result->hasError()) {
             $this->addInfoMessage($result->getMessage());
             $this->redirect('venues', 'own');
         } else {
             $this->addErrorMessage($result->getMessage());
             $this->redirect('venues', 'own');
         }
     } else {
         return new View('venues', 'add', new VenueInputModel());
     }
 }