public async Task <IActionResult> UploadResultsFileAsync(UploadResultsRequestViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            viewModel.AoUkprn = User.GetUkPrn();
            var response = await _resultLoader.ProcessBulkResultsAsync(viewModel);

            if (response.IsSuccess)
            {
                var successfulViewModel = new UploadSuccessfulViewModel {
                    Stats = response.Stats
                };
                await _cacheService.SetAsync(string.Concat(CacheKey, Constants.ResultsUploadSuccessfulViewModel), successfulViewModel, CacheExpiryTime.XSmall);

                return(RedirectToRoute(RouteConstants.ResultsUploadSuccessful));
            }

            if (response.ShowProblemWithServicePage)
            {
                return(RedirectToRoute(RouteConstants.ProblemWithResultsUpload));
            }

            var unsuccessfulViewModel = new UploadUnsuccessfulViewModel
            {
                BlobUniqueReference = response.BlobUniqueReference,
                FileSize            = response.ErrorFileSize,
                FileType            = FileType.Csv.ToString().ToUpperInvariant()
            };

            await _cacheService.SetAsync(string.Concat(CacheKey, Constants.UploadUnsuccessfulViewModel), unsuccessfulViewModel, CacheExpiryTime.XSmall);

            return(RedirectToRoute(RouteConstants.ResultsUploadUnsuccessful));
        }
 public async override Task When()
 {
     ActualResult = await Loader.ProcessBulkResultsAsync(UploadResultsRequestViewModel);
 }