public async Task <Result> Handle(ListWorkOrderQuery request, CancellationToken cancellationToken) { Result result; try { var filter = _filterProvider.Replace(request.Filter, Item.DictionaryOrderItemPath()); int?skip = request.Skip.ToNullableInt(); int?limit = request.Top.ToNullableInt(); var workOrderDomains = await _workOrderReadRepository.ListAsync(filter, skip, limit); var workOrderModels = _mapper.Map <IEnumerable <WorkOrderModel> >(workOrderDomains); var count = workOrderModels.Count(); var workOrdersModels = new WorkOrdersModel { Value = workOrderModels, Count = count, NextLink = null }; result = Result.Ok(workOrdersModels); } catch (FilterODataException) { result = Result.Fail(new System.Collections.Generic.List <Failure>() { new HandlerFault() { Code = HandlerFaultCode.InvalidQueryFilter.Name, Message = HandlerFailures.InvalidQueryFilter, Target = "$filter" } } ); } catch (Exception ex) { _logAs.Error(CustomFailures.ListWorkOrderFailure, ex); result = Result.Fail(CustomFailures.ListWorkOrderFailure); } return(result); }