public async Task <AppealViewModel> GetAppealViewModel(AppealRequest request, string message)
        {
            var oversightReviewTask = _applyApiClient.GetOversightReview(request.ApplicationId);
            var stagedUploadsTask   = _applyApiClient.GetStagedUploads(new GetStagedFilesRequest {
                ApplicationId = request.ApplicationId
            });
            await Task.WhenAll(oversightReviewTask, stagedUploadsTask);

            var oversightReview = _applyApiClient.GetOversightReview(request.ApplicationId).Result;
            var stagedUploads   = _applyApiClient.GetStagedUploads(new GetStagedFilesRequest {
                ApplicationId = request.ApplicationId
            }).Result;

            var result = new AppealViewModel
            {
                ApplicationId          = request.ApplicationId,
                OversightReviewId      = oversightReview.Id,
                AllowAdditionalUploads = stagedUploads.Files.Count < MaxFileUploads,
                UploadedFiles          = stagedUploads.Files.Select(x => new UploadedFileViewModel {
                    Id = x.Id, Filename = x.Filename
                }).ToList(),
                Message = message
            };

            return(result);
        }
        public async Task <OutcomeViewModel> GetOversightDetailsViewModel(Guid applicationId, Guid?outcomeKey)
        {
            var applicationDetailsTask = _applyApiClient.GetApplicationDetails(applicationId);
            var oversightReviewTask    = _applyApiClient.GetOversightReview(applicationId);
            await Task.WhenAll(applicationDetailsTask, oversightReviewTask);

            var applicationDetails = _applyApiClient.GetApplicationDetails(applicationId).Result;
            var oversightReview    = _applyApiClient.GetOversightReview(applicationId).Result;

            GetAppealResponse appealResponse = null;

            if (oversightReview != null)
            {
                appealResponse = await _applyApiClient.GetAppeal(applicationId, oversightReview.Id);
            }

            var viewModel = new OutcomeViewModel
            {
                IsNew = oversightReview == null,
                ApplicationSummary     = CreateApplicationSummaryViewModel(applicationDetails),
                GatewayOutcome         = CreateGatewayOutcomeViewModel(applicationDetails, oversightReview),
                FinancialHealthOutcome = CreateFinancialHealthOutcomeViewModel(applicationDetails),
                ModerationOutcome      = CreateModerationOutcomeViewModel(applicationDetails, oversightReview),
                InProgressDetails      = CreateInProgressDetailsViewModel(oversightReview),
                OverallOutcome         = CreateOverallOutcomeViewModel(oversightReview),
                AppealViewModel        = appealResponse == null ? null : CreateAppealViewModel(applicationDetails, appealResponse),
                ShowAppealLink         = oversightReview != null && oversightReview.Status == OversightReviewStatus.Unsuccessful && appealResponse == null,
                ShowInProgressDetails  = oversightReview?.InProgressDate != null,
                OversightStatus        = oversightReview?.Status ?? OversightReviewStatus.None,
                ApproveGateway         = GetStringValueForApprovalStatusBoolean(oversightReview?.GatewayApproved),
                ApproveModeration      = GetStringValueForApprovalStatusBoolean(oversightReview?.ModerationApproved),
                IsGatewayRemoved       = applicationDetails.ApplicationStatus == ApplicationStatus.Removed,
                IsGatewayFail          = applicationDetails.GatewayReviewStatus == GatewayReviewStatus.Fail,
                HasFinalOutcome        = oversightReview != null && oversightReview.Status != OversightReviewStatus.None && oversightReview.Status != OversightReviewStatus.InProgress
            };

            if (oversightReview == null || oversightReview.Status == OversightReviewStatus.InProgress)
            {
                var cachedItem = await _cacheStorageService.RetrieveFromCache <OutcomePostRequest>(outcomeKey.ToString());

                if (cachedItem == null)
                {
                    return(viewModel);
                }

                viewModel.OversightStatus                 = cachedItem.OversightStatus;
                viewModel.ApproveGateway                  = cachedItem.ApproveGateway;
                viewModel.ApproveModeration               = cachedItem.ApproveModeration;
                viewModel.SuccessfulText                  = cachedItem.SuccessfulText;
                viewModel.SuccessfulAlreadyActiveText     = cachedItem.SuccessfulAlreadyActiveText;
                viewModel.SuccessfulFitnessForFundingText = cachedItem.SuccessfulFitnessForFundingText;
                viewModel.UnsuccessfulText                = cachedItem.UnsuccessfulText;
                viewModel.UnsuccessfulExternalText        = cachedItem.UnsuccessfulExternalText;
                viewModel.InProgressInternalText          = cachedItem.InProgressInternalText;
                viewModel.InProgressExternalText          = cachedItem.InProgressExternalText;
            }

            return(viewModel);
        }