/// <summary>
 /// Send Worker response to Pipe.
 /// </summary>
 private void Send(ProjectDocumentCollection data)
 {
     var message = new PipeMessageEnvelope
     {
         Body = data
     };
     if (OutputDataPipe != null)
         OutputDataPipe.Send(message);
     IncreaseProcessedDocumentsCount(data.Documents.Count);
 }
        /// <summary>
        /// Process documents for Rerun job
        /// </summary>
        /// <param name="projectDocumentCollection">ProjectDocumentCollection</param>
        private void ProcessDocumentsForRerunJob(ProjectDocumentCollection projectDocumentCollection)
        {
             //Fix Existing documents
            var documentsUpdate =
                projectDocumentCollection.Documents.Where(d => d.IsDocumentUpdate)
                    .Select(projectDocument => new Business.Analytics.DocumentIdentifier
                                               {
                                                   ReferenceId = projectDocument.DocumentReferenceId,
                                                   Url = projectDocument.TextFilePath,
                                                   DocumentIndexingStatus = projectDocument.DocumentIndexStatus,
                                                   DocumentTextSize = projectDocument.DocumentTextSize
                                               }).ToList();

            if (documentsUpdate.Any())
            {
                _analyticProject.AddDocumentsIntoProject(_jobParameter.MatterId, _dataset, documentsUpdate,
                    _jobParameter,
                    projectDocumentCollection.ProjectFieldId, WorkAssignment.JobId, true);
            }


            //Add unprocessed documents
            var documentsAdd =
                projectDocumentCollection.Documents.Where(d => !d.IsDocumentUpdate)
                    .Select(projectDocument => new Business.Analytics.DocumentIdentifier
                                               {
                                                   ReferenceId = projectDocument.DocumentReferenceId,
                                                   Url = projectDocument.TextFilePath,
                                                   DocumentIndexingStatus = projectDocument.DocumentIndexStatus,
                                                   DocumentTextSize = projectDocument.DocumentTextSize
                                               }).ToList();

            if (documentsAdd.Any())
            {
                _analyticProject.AddDocumentsIntoProject(_jobParameter.MatterId, _dataset, documentsAdd,
                    _jobParameter,
                    projectDocumentCollection.ProjectFieldId, WorkAssignment.JobId);
            }
        }
        /// <summary>
        /// Send Worker response to Pipe.
        /// </summary>
        private void Send(List<ProjectDocumentDetail> documents)
        {

            var documentCollection = new ProjectDocumentCollection
            {
                Documents = documents
            };
            var message = new PipeMessageEnvelope
            {
                Body = documentCollection
            };
            if (OutputDataPipe != null)
                OutputDataPipe.Send(message);
            IncreaseProcessedDocumentsCount(documents.Count);
        }
 /// <summary>
 /// Send Worker response to Pipe.
 /// </summary>
 private void Send(List<ProjectDocumentDetail> documents)
 {
     if (documents == null || !documents.Any()) return;
     var documentCollection = new ProjectDocumentCollection
     {
         Documents = documents
     };
     var message = new PipeMessageEnvelope
     {
         Body = documentCollection
     };
     if (OutputDataPipe != null)
         OutputDataPipe.Send(message);
 }