/// <summary>
        /// Method for Calling the Azure Endpoint.
        /// </summary>
        /// <param name="request">Request that is passed by Tenant.</param>
        /// <param name="endpointName">Azure endpoint to be used((Primary/Secondary).</param>
        /// <returns>Returns the FileRequestSendResult to Calling method.</returns>
        internal AzureTBNService.FileRequestSendResult CallSendFileRequest(AzureTBNService.FileRequest request)
        {
            int exceptionCount = 0;

            AzureTBNService.FileRequestSendResult            azure_FileRequestSendResult = new AzureTBNService.FileRequestSendResult();
            AzureTBNService.TriggerRequestNotificationClient client = null;
            for (int retryCount = 0; retryCount < retryAttempts; retryCount++)
            {
                try
                {
                    if (FileUpload((request as AzureTBNService.FileRequest).FilePath))
                    {
                        using (client = new AzureTBNService.TriggerRequestNotificationClient(PrimaryEndpoint))
                        {
                            azure_FileRequestSendResult = client.SendFileRequest(request as AzureTBNService.FileRequest);
                        }
                        return(azure_FileRequestSendResult);
                    }
                }

                catch (Exception ex)
                {
                    if (client == null)
                    {
                        throw;
                    }

                    exceptionCount++;

                    // Throw exception if maxm retry attempts are exhausted
                    if (exceptionCount == retryAttempts)
                    {
                        throw new Exception(GenericExceptionMessagePredicate + ex.Message.ToString());
                    }
                }
            }
            return(azure_FileRequestSendResult);
        }
        public AzureTBNService.FileRequestSendResult SendFileRequest(AzureTBNService.FileRequest request)
        {
            string Extension = string.Empty;

            string[] allowedExtensions = { ".tsv", ".csv", ".txt", ".zip", ".gz" };
            long     fileSize;
            string   breakuptime = string.Empty;

            if (ConfigurationManager.AppSettings["breakupTime"] != null)
            {
                breakuptime = ConfigurationManager.AppSettings["breakupTime"].ToString();
            }
            else
            {
                breakuptime = "12";
            }
            if (request == null)
            {
                throw new Exception(ExceptionMessagePredicate + RequestNullException);
            }
            if (string.IsNullOrEmpty(request.BulkSendId) || request.ContentId < 0 || string.IsNullOrEmpty(request.BatchId) || string.IsNullOrEmpty(request.FilePath))
            {
                throw new Exception(ExceptionMessagePredicate + InvalidRequestException);
            }
            if (request.IsOverrideConfiguration)
            {
                int TenantID = 0;
                int.TryParse(request.TenantAccountId, out TenantID);
                if (string.IsNullOrEmpty(request.TenantAccountId) || request.TenantAccountId.Equals("0") || TenantID < 0)
                {
                    throw new Exception(ExceptionMessagePredicate + InvalidRequestException);
                }
                if (!request.IsSendInvoke.HasValue)
                {
                    request.IsSendInvoke = true;
                }
            }
            if (DateTime.Compare(request.ScheduledDateTime, DateTime.MinValue) != 0)
            {
                if (DateTime.Compare(request.ScheduledDateTime, DateTime.UtcNow.AddHours(Convert.ToInt32(breakuptime))) < 0)
                {
                    throw new Exception(ExceptionMessagePredicate + InvalidScheduledDateTimeException);
                }
            }
            if (!File.Exists(request.FilePath))
            {
                throw new Exception(ExceptionMessagePredicate + FileDoesnotExistsException);
            }
            Extension = Path.GetExtension(request.FilePath);

            if (!allowedExtensions.Contains(Extension))
            {
                throw new Exception(ExceptionMessagePredicate + InvalidFileExtension);
            }


            FileStream fileStream = File.OpenRead(request.FilePath);

            fileSize = fileStream.Length;
            if (fileSize > 100 * 1024 * 1024)
            {
                throw new Exception(ExceptionMessagePredicate + FileSizeException);
            }

            AzureTBNService.FileRequestSendResult fileReqSendResult = new AzureTBNService.FileRequestSendResult();

            fileReqSendResult = CallSendFileRequest(request);

            return(fileReqSendResult);
        }