/**
  * @param RegistrationFlow $registrationFlow
  */
 public function registerAction(RegistrationFlow $registrationFlow)
 {
     // We remove already existing flows
     $alreadyExistingFlows = $this->registrationFlowRepository->findByEmail($registrationFlow->getEmail());
     if (count($alreadyExistingFlows) > 0) {
         foreach ($alreadyExistingFlows as $alreadyExistingFlow) {
             $this->registrationFlowRepository->remove($alreadyExistingFlow);
         }
     }
     $registrationFlow->storeEncryptedPassword();
     // Send out a confirmation mail
     $activationLink = $this->uriBuilder->reset()->setCreateAbsoluteUri(true)->uriFor('activateAccount', ['token' => $registrationFlow->getActivationToken()], 'Registration');
     $this->emailService->sendTemplateBasedEmail('ActivationToken', $this->subjectActivation, [$this->emailSenderAddress => $this->emailSenderName], [$registrationFlow->getEmail()], ['activationLink' => $activationLink, 'applicationName' => $this->emailSenderName, 'registrationFlow' => $registrationFlow, 'baseUri' => htmlspecialchars($this->controllerContext->getRequest()->getHttpRequest()->getBaseUri())]);
     $this->registrationFlowRepository->add($registrationFlow);
     $this->view->assign('email', $registrationFlow->getEmail());
 }