private void EndCollect(IDocumentSession session, CollectRequest collectRequest, CollectExecution collectExecution)
 {
     if (collectTimeOut.IsExceededTheMaxOfExecutionsDefined(collectRequest.GetNumberOfExecutions(session)))
     {
         collectRequest.Close();
     }
     else
     {
         if (!collectRequest.isClosed())
         {
             if (!collectExecution.ExistsExecutionsWithError())
             {
                 collectRequest.TryClose(session);
             }
             else
             {
                 collectRequest.Reopen();
             }
         }
     }
     collectExecution.SetDateEndCollect();
     session.SaveChanges();
 }
        private void CheckTheDefaulStateOfRequestCollectAfterOneExecution(CollectRequest requestCollectAfterExecute)
        {
            Assert.IsNotNull(requestCollectAfterExecute);
            Assert.AreEqual(1, requestCollectAfterExecute.GetNumberOfExecutions(session));
            

        }