public async static Task<bool> ExecuteTask(BackgroundTask task)
 {
     for (var i = 0; i < 10; i++)
     {
         using (var session = documentStore.OpenSession())
         {
             switch (task.Run(session))
             {
                 case true:
                 case false:
                     return true;
                 case null:
                     break;
             }
         }
     }
     return false;
 }
 public static void ExcuteLater(BackgroundTask task)
 {
     tasksToExecute.Value.Add(task);
 }