public IActionResult GetProviderFunding(string providerFundingFeedId)
        {
            ProviderFunding data = null;

            if (providerFundingFeedId.StartsWith("DSG_"))
            {
                data = GenerateDSGFunding.GenerateProviderFunding(providerFundingFeedId);
            }
            else if (providerFundingFeedId.StartsWith("PESports_"))
            {
                data = GeneratePESportsFunding.GenerateProviderFunding(providerFundingFeedId);
            }

            return(data == null?NotFound() : (IActionResult)Ok(data));
        }
        public HttpResponseMessage DownloadDSGFiles()
        {
            var takeAtOnce         = 10;
            var processedFileNames = new List <string>();

            byte[]          fileBytes = null;
            ZipArchiveEntry zipItem;

            using (var memoryStream = new System.IO.MemoryStream())
            {
                var feed = GenerateDSGFunding.GenerateFeed(null, null, null, null, null, null, null, null, null, null, null, null, null, null);

                using (var zip = new ZipArchive(memoryStream, ZipArchiveMode.Create, true))
                {
                    for (var idx = 0; idx <= (int)Math.Ceiling(feed.Length / 10.0); idx++)
                    {
                        var feedResponse = feed.Skip(idx * 10).Take(10).ToArray();

                        foreach (var feedEntry in feedResponse)
                        {
                            foreach (var providerFundingId in feedEntry.Content.Funding.ProviderFundings)
                            {
                                var fileName = $"{providerFundingId}.txt";

                                if (processedFileNames.Contains(fileName))
                                {
                                    continue;
                                }

                                var funding    = GenerateDSGFunding.GenerateProviderFunding(providerFundingId);
                                var fundingStr = JsonConvert.SerializeObject(funding);

                                zipItem = zip.CreateEntry(fileName);
                                processedFileNames.Add(fileName);

                                using (var originalFileMemoryStream = new System.IO.MemoryStream(Encoding.ASCII.GetBytes(fundingStr)))
                                {
                                    using (var entryStream = zipItem.Open())
                                    {
                                        originalFileMemoryStream.CopyTo(entryStream);
                                    }
                                }
                            }
                        }

                        zipItem = zip.CreateEntry($"FeedResponse{(idx * takeAtOnce) + 1}-{(idx * takeAtOnce) + feedResponse.Length}.txt");
                        var feedResponseStr = JsonConvert.SerializeObject(feedResponse);

                        using (var originalFileMemoryStream = new System.IO.MemoryStream(Encoding.ASCII.GetBytes(feedResponseStr)))
                        {
                            using (var entryStream = zipItem.Open())
                            {
                                originalFileMemoryStream.CopyTo(entryStream);
                            }
                        }
                    }
                }

                fileBytes = memoryStream.ToArray();
            }

            var result = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new ByteArrayContent(fileBytes)
            };

            result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                FileName = "allDsg.zip"
            };

            result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/zip");

            return(result);
        }