/// <summary>
        /// This routine creates a background worker and starts it working on another thread to 
        /// periodically poll SQL server and refresh this applications cached data as needed.
        /// </summary>
        public static void StartBackgroundWorker(LovehitchBackgroundWorker backgroundWorker)
        {
            var worker = backgroundWorker;
            //worker.DoWork += new DoWorkEventHandler(SqlPollingWork);
            //worker.WorkerReportsProgress = false;
            //worker.WorkerSupportsCancellation = true;
            //worker.RunWorkerCompleted +=
            //       new RunWorkerCompletedEventHandler(SqlPollingWorkCompleted);
            worker.RunWorkerAsync(backgroundWorker.Context); //Pass HttpContext to background worker

            //Add this BackgroundWorker object instance to the application variables 
            //so it can be cleared when the Application_End event fires.
            //HttpContext.Current.Application.GetVariables().SqlPollingBackgroundWorker = worker;

            //((Dictionary<string, LovehitchBackgroundWorker>)
            //    backgroundWorker.Context.Application["BackgroundWorkersDic"])
            //        .Add(worker.GetType().ToString(), worker);
            Global.AppBackgroundWorkersDic.Add(worker.GetType().ToString(), worker);
        }
 public static void StopBackgroundWorker(LovehitchBackgroundWorker backgroundWorker)
 {
     var worker = backgroundWorker;
     if (worker != null)
         worker.CancelAsync();
 }