public async Task <GetApplicantsResponse> Handle(GetApplicantsQuery request, CancellationToken cancellationToken)
        {
            var validationErrors = ValidateRequest(request);

            if (validationErrors.Any())
            {
                return(new GetApplicantsResponse {
                    ResultCode = ResponseCode.InvalidRequest, ValidationErrors = validationErrors
                });
            }

            var vacancyApplications = await _queryStoreReader.GetVacancyApplicationsAsync(request.VacancyReference.ToString());

            if (vacancyApplications == null || vacancyApplications.Applications.Any() == false)
            {
                return(new GetApplicantsResponse {
                    ResultCode = ResponseCode.NotFound
                });
            }

            var applicants = FilterApplicants(request.ApplicantApplicationOutcomeFilter, vacancyApplications);

            if (applicants.Any() == false)
            {
                return(new GetApplicantsResponse {
                    ResultCode = ResponseCode.NotFound
                });
            }

            return(new GetApplicantsResponse
            {
                ResultCode = ResponseCode.Success,
                Data = applicants.Select(ApplicantSummaryMapper.MapFromVacancyApplication)
            });
        }
 public Task <VacancyApplications> GetVacancyApplicationsAsync(string vacancyReference)
 {
     return(_reader.GetVacancyApplicationsAsync(vacancyReference));
 }