/// <summary>
        /// Run Mainline for the incoming Blob watcher.
        /// </summary>
        /// <param name="ct"></param>
        /// <param name="storageAccountString"></param>
        /// <param name="ContainersToScan"></param>
        /// <returns></returns>
        public static async Task runInboundJobWatcher(CancellationToken ct, string storageAccountString, string[] ContainersToScan)
        {
            _storageAccountString = storageAccountString;
            //    var pollingInterval = TimeSpan.FromSeconds(60);

            int msBetweenPolls = 1000 * Configuration.BlobWatcherPollingInterval;
            // Run the mainline for BlobWatcher

            CloudStorageAccount account = CloudStorageAccount.Parse(storageAccountString);
            var cl = account.CreateCloudBlobClient();

            // Set up the container objects
            var containers = new List <CloudBlobContainer>(ContainersToScan.Length);

            foreach (var containerName in ContainersToScan)
            {
                containers.Add(cl.GetContainerReference(containerName));
            }

            Trace.TraceInformation("Scanning: containers=(" + String.Join(", ", ContainersToScan) + ")");

            try
            {
                while (!ct.IsCancellationRequested)
                {
                    // for now, just run the scan at serially... later change to background run in parallel.
                    foreach (var cbc in containers)
                    {
                        try
                        {
                            BlobWatcher.ScanContainerForInbound(cbc);
                        }
                        catch (Exception ex)
                        {
                            if (ex as OperationCanceledException != null)
                            {
                                throw;
                            }
                            Trace.TraceInformation("Exception scanning container {0}, Msg='{1}'", cbc.Name, ex.Message);
                            // and continue
                        }
                    }

                    Trace.TraceInformation("Scanning: back to sleep for {0} secs", msBetweenPolls / 1000);
                    await Task.Delay(msBetweenPolls);
                }
            }
            catch (OperationCanceledException ocEx)
            {
                var ex = ocEx;      // to avoid compiler warning
                // Expect this exception to be thrown in normal circumstances or check
                // the cancellation token. If the role instances are shutting down, a
                // cancellation request will be signaled.
                Trace.TraceInformation("Stopping BlobWatcher service, cancellation requested");
                // Re-throw the Operation cancellation exception
                throw;
            }
        }
        public async Task Run()
        {
            string s          = MediaButler.Common.Configuration.GetConfigurationValue("ContainersToScan", "MediaButler.Workflow.WorkerRole");
            var    containers = s.Split(',');

            string[] ContainersToScan = containers;

            var taskFailedRequests      = Task.Run(() => JobManager.getWorkflowFailedOperations(Token, _storageAccountString));
            var taskSuccessfulRequests  = Task.Run(() => JobManager.getWorkflowSuccessOperations(Token, _storageAccountString));
            var taskProcessIncomingJobs = Task.Run(() => BlobWatcher.runInboundJobWatcher(Token, _storageAccountString, ContainersToScan));

            Task.WaitAll(taskFailedRequests, taskSuccessfulRequests, taskProcessIncomingJobs);
        }