private static async Task <int> ProcessQuery(OMSIngestionApi oms, HttpClient client, String query, TraceWriter log)
        {
            try
            {
                int count = 0;
                var tasks = new List <Task>();
                while (!string.IsNullOrEmpty(query))
                {
                    var response = client.GetAsync(new Uri(query)).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        var result = response.Content.ReadAsStringAsync().Result;
                        JsonResult <UCDDHourly> jsonResult = default(JsonResult <UCDDHourly>);
                        jsonResult = JsonConvert.DeserializeObject <JsonResult <UCDDHourly> >(result);
                        var jsonList = JsonConvert.SerializeObject(jsonResult.data.ToList());
                        tasks.Add(oms.SendOMSApiIngestionFile(jsonList));
                        count = count + jsonResult.data.ToList().Count;
                        Console.WriteLine($"Count {count}");
                        log.Info($"Count {count}");
                        query = jsonResult.nextLink;
                    }
                    else
                    {
                        var result = response.Content.ReadAsStringAsync().Result;
                        log.Info(result);
                        break;
                    }
                }
                await Task.WhenAll(tasks.ToArray());

                log.Info($"Final Record Count {count}");
                return(count);
            }
            catch (Exception e)
            {
                log.Info($"Failed processing. Reason: {e}");
                throw e;
            }
        }
        public static async Task StartIngestion(TraceWriter log)
        {
            //Save your workspaceid and workspacekey in KeyVault
            workspaceid  = CryptoHelper.GetKeyVaultSecret("omsworkspaceid");
            workspacekey = CryptoHelper.GetKeyVaultSecret("omsworkspacekey");
            if (string.IsNullOrEmpty(workspaceid))
            {
                log.Info($"OmsWorkspaceId is empty. Cannot proceed further");
                return;
            }

            if (string.IsNullOrEmpty(workspacekey))
            {
                log.Info($"omsworkspacekey is empty. Cannot proceed further");
                return;
            }

            log.Info("Sending logs to OMS");
            var        oms    = new OMSIngestionApi(workspaceid, workspacekey, log);
            HttpClient client = HttpHandler.BuildClient();
            int        count  = await ProcessQuery(oms, client, GetUsageQueryUrl(log), log);

            log.Info($"Finished processing files");
        }