internal static void UpdateEpg(Action<string> CallBack = null)
 {
     Logger.ILog("Update EPG Started");
     NUtility.PluginRegistry.GetInstance().LoadPlugins();
     NShared.RecordingServiceProxy.ForceRemote();
     ScheduleHelperFactory.SetScheduleHelper(GetRecordingServiceInstance());
     NShared.EPGManager manager = new NShared.EPGManager();
     WebConsoleEpgUpdateCallback wcCallback = new WebConsoleEpgUpdateCallback(CallBack);
     System.Threading.Tasks.Task.Factory.StartNew(delegate
     {
         if (!EpgUpdateMutex.WaitOne(100))
         {
             Logger.ELog("Failed to update EPG, already running.");
             return;
         }
         try
         {
             Hubs.NextPvrEventHub.Clients_ShowInfoMessage("EPG Update Started");
             manager.UpdateEPG(wcCallback);
             Hubs.NextPvrEventHub.Clients_ShowInfoMessage("EPG Update Completed");
         }
         catch (Exception ex)
         {
             Hubs.NextPvrEventHub.Clients_ShowErrorMessage(ex.Message, "EPG Update Failed");
             wcCallback.SetEPGUpdateStatus("ERROR: " + ex.Message);
         }
         finally
         {
             System.Threading.Thread.Sleep(10000);
             EpgUpdateMutex.ReleaseMutex();
         }
     });
 }
 internal static void EmptyEpg()
 {
     Logger.ILog("Emptying EPG");
     NShared.EPGManager manager = new NShared.EPGManager();
     manager.EmptyEPG();
     FlushEpgCache();
 }