public async Task <bool> Handle(ExtractHTSClient request, CancellationToken cancellationToken) { //Extract int found = await _patientSourceExtractor.Extract(request.Extract, request.DatabaseProtocol); //Validate await _extractValidator.Validate(request.Extract.Id, found, "HtsClientExtracts", "TempHtsClientExtracts"); //Load int loaded = await _patientLoader.Load(request.Extract.Id, found); int rejected = _extractHistoryRepository.ProcessRejected(request.Extract.Id, found - loaded, request.Extract); _extractHistoryRepository.ProcessExcluded(request.Extract.Id, rejected, request.Extract); //notify loaded DomainEvents.Dispatch( new HtsExtractActivityNotification(request.Extract.Id, new ExtractProgress( nameof(HTSClientExtract), nameof(ExtractStatus.Loaded), found, loaded, rejected, loaded, 0))); return(true); }