public async Task <TouchpointProviderFundingData> ProvideAsync(TouchpointProvider touchpointProvider, ISummarisationMessage summarisationMessage, CancellationToken cancellationToken)
        {
            var providers = _providers;

            var taskResults = await Task.WhenAll(providers.Select(p => p.ProvideAsync(touchpointProvider, summarisationMessage, cancellationToken)));

            return(new TouchpointProviderFundingData
            {
                Provider = touchpointProvider,
                FundingValues = taskResults.SelectMany(x => x).ToList()
            });
        }
        public async Task <ICollection <FundingValue> > ProvideAsync(TouchpointProvider touchpointProvider, ISummarisationMessage summarisationMessage, CancellationToken cancellationToken)
        {
            var maxDate = new DateTime(summarisationMessage.CollectionYear % 100 + 2000, 3, 31);

            using (var ncsContext = _ncsContext())
            {
                var fundingValues = await ncsContext.FundingValues
                                    .Where(fv => fv.Ukprn == touchpointProvider.UKPRN &&
                                           fv.TouchpointId == touchpointProvider.TouchpointId &&
                                           fv.CollectionYear == summarisationMessage.CollectionYear &&
                                           fv.OutcomeEffectiveDate <= maxDate)
                                    .Select(s => new FundingValue
                {
                    CollectionYear = s.CollectionYear,
                    CalendarMonth  = s.OutcomeEffectiveDateMonth,
                    OutcomeType    = s.OutcomeType,
                    Value          = s.Value
                }).ToListAsync(cancellationToken);


                return(fundingValues);
            }
        }
        private async Task <TouchpointProviderFundingData> RetrieveProviderData(TouchpointProvider identifier, ISummarisationMessage summarisationMessage, CancellationToken cancellationToken)
        {
            var repo = _repositoryFactory();

            return(await repo.ProvideAsync(identifier, summarisationMessage, cancellationToken));
        }