public async Task <LegalNamePageViewModel> GetLegalNameViewModel(GetLegalNameRequest request) { _logger.LogInformation($"Retrieving legal name details for application {request.ApplicationId}"); var model = new LegalNamePageViewModel(); await model.PopulatePageCommonDetails(_applyApiClient, request.ApplicationId, GatewaySequences.OrganisationChecks, GatewayPageIds.LegalName, request.UserId, request.UserName, RoatpGatewayConstants.Captions.OrganisationChecks, RoatpGatewayConstants.Headings.LegalName, NoSelectionErrorMessages.Errors[GatewayPageIds.LegalName]); var ukrlpDetails = await _applyApiClient.GetUkrlpDetails(request.ApplicationId); if (ukrlpDetails != null) { model.UkrlpLegalName = ukrlpDetails.ProviderName; if (ukrlpDetails.VerifiedByCompaniesHouse) { var companiesHouseDetails = await _applyApiClient.GetCompaniesHouseDetails(request.ApplicationId); if (companiesHouseDetails != null) { model.CompaniesHouseLegalName = companiesHouseDetails.CompanyName; } } if (ukrlpDetails.VerifiedbyCharityCommission) { var charityCommissionDetails = await _applyApiClient.GetCharityCommissionDetails(request.ApplicationId); if (charityCommissionDetails != null) { model.CharityCommissionLegalName = charityCommissionDetails.CharityName; } } } return(model); }