public async Task <IEnumerable <DeploymentDto> > Handle(ListDeploymentsRequest request, CancellationToken cancellationToken) { var entities = await _deploymentRepository .RetrieveAllDeploymentsAsync(request.Skip, request.Take); if (entities == null) { throw new StatusException(StatusCodes.Status500InternalServerError, "Could not retrieve any deployments."); } var deployments = _mapper.Map <IEnumerable <DeploymentDto> >(entities); return(deployments); }