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();
 }