public async Task <IActionResult> Index(DataProtectionVm model) { if (!ModelState.IsValid) { _buildDataProtectionVm.PopulateDateComponents(model); model.NotificationMessage = ValidationMessages.DPAFailure; AddErrors(ValidationMessages.DPAFailure); _gtmService.RaiseDPACheckEvent(model, LoggedInUserId, "Invalid account details"); await _webActivityService.LogDPACheckFail(model.LowellReference, LoggedInUserId); return(View(model)); } var resultDto = await _dataProtectionService.CheckDataProtection(model); if (resultDto.IsSuccessful) { var lowellReferenceSurrogateKey = ApplicationSessionState.AddLowellReferenceSurrogateKey(model.LowellReference); ApplicationSessionState.SaveHasPassedDataProtection(); _gtmService.RaiseDPACheckEvent(model, LoggedInUserId, null); await _webActivityService.LogDPACheckSuccess(model.LowellReference, LoggedInUserId); TempData["GTMEvents"] = JsonConvert.SerializeObject(model.GtmEvents); return(RedirectToAction("Index", "PaymentOptions", new { id = lowellReferenceSurrogateKey })); } model.NotificationMessage = resultDto.MessageForUser; AddErrors(ValidationMessages.DPAFailure); _buildDataProtectionVm.PopulateDateComponents(model); _gtmService.RaiseDPACheckEvent(model, LoggedInUserId, "Incorrect account details"); await _webActivityService.LogDPACheckFail(model.LowellReference, LoggedInUserId); return(View(model)); }