public async Task Execute(IEnumerable <FundingDto> fundingDtos, IFundingServiceContext fundingServiceContext, CancellationToken cancellationToken)
        {
            _logger.LogDebug($"Starting {_taskName} Task");

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            List <Task <TOut> > taskList = new List <Task <TOut> >();

            foreach (FundingDto fundingDto in fundingDtos)
            {
                taskList.Add(Process(fundingDto, cancellationToken));
            }

            await Task.WhenAll(taskList).ConfigureAwait(false);

            IEnumerable <TOut> results = taskList.Select(t => t.Result) ?? Enumerable.Empty <TOut>();
            var output = _fundingOutputCondenserService.Condense(results, fundingServiceContext.Ukprn, fundingServiceContext.Year);

            fundingServiceContext.FundingOutputKeys.TryGetValue(_outputKey, out var outputFileName);

            await _filePersistanceService.PersistAsync(outputFileName, fundingServiceContext.Container, output, cancellationToken).ConfigureAwait(false);

            _logger.LogDebug($"Persisted {_taskName} results - {stopWatch.ElapsedMilliseconds}");
        }
        public async Task Execute(IEnumerable <FundingDto> fundingActorDtos, IFundingServiceContext fundingServiceContext, CancellationToken cancellationToken)
        {
            _logger.LogDebug($"Starting {_actorName} Actors");

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            List <Task <string> > taskList = new List <Task <string> >();
            List <IFM25Actor>     actors   = new List <IFM25Actor>();

            foreach (FundingDto fundingActorDto in fundingActorDtos)
            {
                IFM25Actor actor = _fundingActorProvider.Provide();
                actors.Add(actor);
                taskList.Add(actor.Process(fundingActorDto, cancellationToken));
            }

            await Task.WhenAll(taskList).ConfigureAwait(false);

            IEnumerable <FM25Global> results = taskList.Select(t => _jsonSerializationService.Deserialize <FM25Global>(t.Result)) ?? Enumerable.Empty <FM25Global>();

            _logger.LogDebug($"Completed {taskList.Count} {_actorName} Actors - {stopWatch.ElapsedMilliseconds}");

            List <Task> tasksDestroy = new List <Task>();

            foreach (IFM25Actor actor in actors)
            {
                tasksDestroy.Add(_fundingActorProvider.DestroyAsync(actor, cancellationToken));
            }

            await Task.WhenAll(tasksDestroy).ConfigureAwait(false);

            _logger.LogDebug($"Destroyed {taskList.Count} {_actorName} Actors - {stopWatch.ElapsedMilliseconds}");

            stopWatch.Restart();

            var output = _fundingOutputCondenserService.Condense(results, fundingServiceContext.Ukprn, fundingServiceContext.Year);

            await _filePersistanceService.PersistAsync(fundingServiceContext.FundingFm25OutputKey, fundingServiceContext.Container, output, cancellationToken).ConfigureAwait(false);

            _logger.LogDebug($"Persisted {_actorName} results - {stopWatch.ElapsedMilliseconds}");
        }