public async Task <ActionResult> GateWayResponse()
        {
            try
            {
                _logger.Info("Starting processing gateway response");

                var response = await _employerAccountOrchestrator.GetGatewayTokenResponse(Request.Params[ControllerConstants.CodeKeyName], Url.Action(ControllerConstants.GateWayResponseActionName, ControllerConstants.EmployerAccountControllerName, null, Request.Url.Scheme), System.Web.HttpContext.Current?.Request.QueryString);

                if (response.Status != HttpStatusCode.OK)
                {
                    _logger.Warn($"Gateway response does not indicate success. Status = {response.Status}.");
                    response.Status = HttpStatusCode.OK;

                    AddFlashMessageToCookie(response.FlashMessage);

                    return(RedirectToAction(ControllerConstants.GatewayInformActionName));
                }

                var externalUserId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName);
                _logger.Info($"Gateway response is for user identity ID {externalUserId}");

                var email  = OwinWrapper.GetClaimValue(ControllerConstants.EmailClaimKeyName);
                var empref = await _employerAccountOrchestrator.GetHmrcEmployerInformation(response.Data.AccessToken, email);

                _logger.Info($"Gateway response is for empref {empref.Empref} \n {JsonConvert.SerializeObject(empref)}");

                var enteredData = _employerAccountOrchestrator.GetCookieData(HttpContext);

                enteredData.EmployerRefName = empref.EmployerLevyInformation?.Employer?.Name?.EmprefAssociatedName ?? "";
                enteredData.PayeReference   = empref.Empref;
                enteredData.AccessToken     = response.Data.AccessToken;
                enteredData.RefreshToken    = response.Data.RefreshToken;
                enteredData.EmpRefNotFound  = empref.EmprefNotFound;
                _employerAccountOrchestrator.UpdateCookieData(HttpContext, enteredData);

                _logger.Info("Finished processing gateway response");
                return(RedirectToAction(ControllerConstants.SummaryActionName));
            }
            catch (Exception ex)
            {
                _logger.Error(ex, $"Error processing Gateway response - {ex.Message}");
                throw;
            }
        }