private static void SendEmail(string blobName, string PayerID)
        {
            string FileName = System.IO.Path.GetFileName(blobName);
            string text     = string.Empty;
            CloudStorageAccount mycloudStorageAccount = CloudStorageAccount.Parse(Environment.GetEnvironmentVariable("StorageConnection"));
            CloudBlobClient     blobClient            = mycloudStorageAccount.CreateCloudBlobClient();
            CloudBlobContainer  container             = blobClient.GetContainerReference("claimshark");
            var blob = container.GetBlockBlobReference(PayerID + "/FileRegister/Details_" + FileName);

            using (var stream = new System.IO.MemoryStream())
            {
                blob.DownloadToStreamAsync(stream).Wait();
                text = System.Text.Encoding.UTF8.GetString(stream.ToArray());
            }
            if (!String.IsNullOrEmpty(text))
            {
                FileDetails fileDetails = JsonConvert.DeserializeObject <FileDetails>(text);

                string msgSring = "<table> <tr>";
                msgSring += "<td> Payer ID : </td> <td> <strong> " + fileDetails.PayerID + "</strong> </td> </tr>";
                msgSring += "<tr> <td> File Name : </td> <td> <strong> " + fileDetails.FileName + "</strong> </td> </tr>";
                msgSring += "<tr> <td> AcceptedRecords : </td> <td> <strong> " + fileDetails.AcceptedRecords + "</strong> </td> </tr>";
                msgSring += "<tr> <td> ErrorRecords : </td> <td> <strong> " + fileDetails.ErrorRecords + "</strong> </td> </tr>";
                msgSring += "<tr> <td> TotalRecords : </td> <td> <strong> " + fileDetails.TotalRecords + "</strong> </td> </tr>";
                msgSring += "</table>";
                string sendGridKey = Environment.GetEnvironmentVariable("SendGridKey");
                SendGrid.SendGridClient sendGridClient = new SendGridClient(sendGridKey);
                var msg = new SendGridMessage()
                {
                    From        = new EmailAddress("*****@*****.**", "ClaimShark Team"),
                    Subject     = "ClaimShark Etl",
                    HtmlContent = msgSring
                };
                msg.AddTo(new EmailAddress("*****@*****.**", "Bimal Kurichiyath"));
                msg.AddTo(new EmailAddress("*****@*****.**", "Dinesh Kumar Panda"));
                msg.AddTo(new EmailAddress("*****@*****.**", "Sai Ganesh Swamy Kasina"));
                sendGridClient.SendEmailAsync(msg).Wait();
            }
        }
        private static void LogFileDetails(List <FileError> fileErrors, string blobName, string PayerID)
        {
            string      FileName    = System.IO.Path.GetFileName(blobName);
            FileDetails fileDetails = new FileDetails()
            {
                PayerID         = PayerID,
                TotalRecords    = dtPayerDataTable.Rows.Count.ToString(),
                AcceptedRecords = (dtPayerDataTable.Rows.Count - fileErrors.Count).ToString(),
                ErrorRecords    = fileErrors.Count.ToString(),
                FileName        = FileName
            };
            CloudStorageAccount mycloudStorageAccount = CloudStorageAccount.Parse(Environment.GetEnvironmentVariable("StorageConnection"));
            CloudBlobClient     blobClient            = mycloudStorageAccount.CreateCloudBlobClient();
            CloudBlobContainer  container             = blobClient.GetContainerReference("claimshark");

            container.CreateIfNotExistsAsync().Wait();
            var blob = container.GetBlockBlobReference(PayerID + "/FileRegister/Details_" + FileName);

            using (Stream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(fileDetails))))
            {
                blob.UploadFromStreamAsync(stream).Wait();
            }
        }