public function add(AbstractController $controller, $redirect)
 {
     try {
         $fo = FOFactory::build('comment');
         if (!$fo->isSent()) {
             $this->redirectToCaller($redirect);
         }
         $this->model->add($fo, $fo->getType(), $fo->getId());
         $this->redirectToCaller($redirect);
     } catch (FormValidationException $e) {
         $this->values->error = Bundle::get('form.validation.invalid.value', $e->getMessage());
         $controller->setAction($redirect);
     }
 }
 /**
  * Validate form data and register new user.
  * @Invocable
  */
 protected function register()
 {
     try {
         $fo = FOFactory::build('register');
         if (!$fo->isSent()) {
             return;
         }
         $this->model->register($fo);
         $this->request->success = Bundle::get('form.validation.field.register.success');
     } catch (FormValidationException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.invalid.value', $e->getMessage());
     } catch (DuplicateException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.login.taken', $e->getField());
     }
 }
 /**
  * @Invocable
  */
 protected function add()
 {
     try {
         $fo = FOFactory::build('newvideo');
         if (!$fo->isSent()) {
             return;
         }
         $this->model->add($fo);
         Navigator::redirectTo('video');
     } catch (FormValidationException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.invalid.value', $e->getMessage());
     } catch (VideoNotExistsException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.video.url.incorrect', $e->getMessage());
     }
 }
 /**
  * Create new password and send to User's email.
  * @Invocable
  */
 public function recover()
 {
     try {
         $fo = FOFactory::build('recover');
         if (!$fo->isSent()) {
             return;
         }
         $this->model->recover($fo);
         $this->request->success = Bundle::get('recover.message.success.password.sent');
     } catch (FormNotFoundException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.processing.problem');
     } catch (FormValidationException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.invalid.value', $e->getMessage());
     } catch (NoResultException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('recover.message.error.invalid.email', $fo->getEmail());
     }
 }