function saveEventRegistrationRequest($data, Form $form)
 {
     // Check if the honeypot has been filled out
     if (@$data['username']) {
         SS_Log::log(sprintf('EventRegistrationRequestForm honeypot triggered (data: %s)', http_build_query($data)), SS_Log::NOTICE);
         return $this->httpError(403);
     }
     try {
         $this->event_registration_request_manager->registerEventRegistrationRequest($data);
         Session::clear("FormInfo.Form_EventRegistrationRequestForm.data");
         $form->clearMessage();
         return $this->redirect($this->Link('?saved=1'));
     } catch (EntityValidationException $ex1) {
         $messages = $ex1->getMessages();
         $msg = $messages[0];
         $form->addErrorMessage('City', $msg['message'], 'bad');
         SS_Log::log($msg['message'], SS_Log::ERR);
         // Load errors into session and post back
         Session::set("FormInfo.Form_EventRegistrationRequestForm.data", $data);
         return $this->redirectBack();
     } catch (Exception $ex) {
         $form->addErrorMessage('Title', 'Server Error', 'bad');
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         // Load errors into session and post back
         Session::set("FormInfo.Form_EventRegistrationRequestForm.data", $data);
         return $this->redirectBack();
     }
 }
 public function rejectEventRegistrationRequest()
 {
     try {
         $data = $this->getJsonRequest();
         if (!$data) {
             return $this->serverError();
         }
         $request_id = (int) $this->request->param('REQUEST_ID');
         $this->event_registration_request_manager->rejectEventRegistration($request_id, $data, Director::absoluteURL('community/events/'));
         return $this->updated();
     } catch (NotFoundEntityException $ex1) {
         SS_Log::log($ex1, SS_Log::WARN);
         return $this->notFound($ex1->getMessage());
     } catch (EntityValidationException $ex2) {
         SS_Log::log($ex2, SS_Log::WARN);
         return $this->validationError($ex2->getMessages());
     } catch (Exception $ex) {
         SS_Log::log($ex, SS_Log::ERR);
         return $this->serverError();
     }
 }