/// <summary>
        /// Async Delegate to do processing after we construct the content of file.
        /// 1. Upload the content to blob store, upload pending
        /// 2. Ftp to FDC
        /// 3. Mark as uploaded
        /// </summary>
        /// <param name="content">
        /// Content of the file
        /// </param>
        /// <returns>
        /// Async Task Wrapper
        /// </returns>
        public async Task OnPtsBuild(string content)
        {
            IFtpClient ftpClient = FirstDataFtpClientFactory.FirstDataPtsFtpClient(Logger);

            string connectionString           = CloudConfigurationManager.GetSetting("Lomo.Commerce.Fdc.Blob.ConnectionString");
            FirstDataPtsBlobClient blobClient = FirstDataBlobClientFactory.FirstDataPtsBlobClient(connectionString, Logger);

            // FDC requires EST.
            TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
            DateTime     estNow      = TimeZoneInfo.ConvertTime(DateTime.UtcNow, easternZone);
            string       fileName    = estNow.ToString("yyyyMMddHmmss") + ".GPTD5628.TXT";

            //upload file to blob store
            byte[]       contentBytes = Encoding.ASCII.GetBytes(content);
            MemoryStream ms           = new MemoryStream(contentBytes);

            ms.Position = 0;
            await blobClient.UploadAsync(ms, fileName);

            Logger.Verbose("Uploaded file {0} to blob stored to be Ftped to FDC", fileName);

            // ftp it only if there are transactions
            if (!IsFileEmpty(ms))
            {
                ms.Position = 0;
                await ftpClient.UploadFileAsync(fileName, ms);

                Logger.Verbose("File {0} uploaded to FDC", fileName);
            }

            // mark done
            await blobClient.MarkAsUploadedAsync(fileName);

            Logger.Verbose("File {0} marked as uploaded", fileName);
        }
        /// <summary>
        /// 1. Process the FDC Extract file.
        /// 2. Schedule the Process Pts Job
        /// </summary>
        /// <param name="details">
        /// Details of the job we are executing here.
        /// </param>
        /// <param name="logger">
        /// Handle to the logger
        /// </param>
        public async Task Execute(ScheduledJobDetails details, CommerceLog logger)
        {
            logger.Verbose("Starting execution of job \r\n " +
                           "Details {0}", details);

            string     connectionString = CloudConfigurationManager.GetSetting("Lomo.Commerce.Fdc.Blob.ConnectionString");
            IFtpClient ftpClient        = FirstDataFtpClientFactory.FirstDataExtractFtpClient(logger);

            FirstDataExtractBlobClient blobClient = FirstDataBlobClientFactory.FirstDataExtractBlobClient(connectionString, logger);

            string[] files = await ftpClient.DirectoryListAsync();

            if (files != null)
            {
                foreach (string fileName in files)
                {
                    MemoryStream memStream = new MemoryStream();
                    await ftpClient.DownloadFileAsync(fileName, memStream).ConfigureAwait(false);

                    // lets upload it to blob
                    memStream.Position = 0;
                    await blobClient.UploadAsync(memStream, fileName).ConfigureAwait(false);
                }
            }

            // Now try to run all the pending files in the blob
            ICollection <string> listOfFiles = blobClient.RetrieveFilesToProcess();

            if (listOfFiles != null)
            {
                foreach (string fileName in listOfFiles)
                {
                    MemoryStream memStream = new MemoryStream();
                    memStream.Position = 0;
                    await blobClient.DownloadAsync(memStream, fileName).ConfigureAwait(false);

                    memStream.Position = 0;
                    ISettlementFileProcessor extractProcessor = FirstDataFileProcessorFactory.FirstDataExtractProcessor(fileName, memStream);
                    await extractProcessor.Process().ConfigureAwait(false);

                    await blobClient.MarkAsProcessedAsync(fileName).ConfigureAwait(false);
                }
            }

            logger.Verbose("Execution of job {0} complete ", details.JobId);
        }