public async Task <IActionResult> Index(DataProtectionVm model) { if (!ModelState.IsValid) { // List of days, months, years will not have been posted back, therefore repopulate _buildDataProtectionVm.PopulateDateComponents(model); _gtmService.RaiseRegistrationEvent_AccountDetailsEntered(model, "Invalid account details"); return(View(model)); } var dataProtectionDto = _mapper.Map <DataProtectionVm, DataProtectionDto>(model); var dataProtectionResult = await _registerService.CheckDataProtection(dataProtectionDto); if (!dataProtectionResult.IsSuccessful) { AddErrors(dataProtectionResult.MessageForUser); model.NotificationMessage = dataProtectionResult.MessageForUser; _gtmService.RaiseRegistrationEvent_AccountDetailsEntered(model, "Incorrect account details"); _buildDataProtectionVm.PopulateDateComponents(model); return(View(model)); } var webRegisteredDto = _mapper.Map <DataProtectionVm, WebRegisteredDto>(model); var isWebRegisteredResult = await _registerService.CheckIsWebRegistered(webRegisteredDto); if (!isWebRegisteredResult.IsSuccessful) { AddErrors(isWebRegisteredResult.MessageForUser); model.NotificationMessage = isWebRegisteredResult.MessageForUser; _gtmService.RaiseRegistrationEvent_AccountDetailsEntered(model, "Already registered"); _buildDataProtectionVm.PopulateDateComponents(model); return(View(model)); } var registrationPending = await _registerService.IsPendingRegistration(model.LowellReference); if (registrationPending) { var error = "Account details provided is already registered. Please confirm your email account and login."; AddErrors(error); model.NotificationMessage = error; ModelState.AddModelError(string.Empty, "Account details provided is already registered. Please confirm your email account and login."); return(View(model)); } ApplicationSessionState.SaveHasPassedDataProtection(); var registerVm = new RegisterVm { LowellReference = model.LowellReference }; _gtmService.RaiseRegistrationEvent_AccountDetailsEntered(registerVm, null); return(View("CompleteRegistration", registerVm)); }