/**
  * @param RegisterInputModel $model
  * @return mixed
  * @Validatetoken('token')
  * @Method('GET', 'POST')
  */
 public function register(RegisterInputModel $model) : View
 {
     if (!$model->isValid()) {
         return new View('account', 'register', $model);
     }
     $service = new AccountService($this->dbContext);
     if (HttpContext::getInstance()->isPost()) {
         $result = $service->register($model);
         if (!$result->hasError()) {
             $this->addInfoMessage('Registration was successful.');
             $this->redirect('home', 'index');
         } else {
             $this->addErrorMessage('Registration failed.');
             $this->redirect('account', 'register');
         }
     } else {
         return new View('account', 'register', new RegisterInputModel());
     }
 }