public async Task <IServiceResult> GetSingleAsync(string id) { try { var shippingId = id.ToGuid(); var shipping = await _repository.GetSingleAsync(shippingId); if (shipping == null) { throw new NotFoundException(nameof(shipping), id); } var shippingDto = _mapper.Map <Shipping, ShippingDto>(shipping); return(new ServiceResult(payload: shippingDto)); } catch (Exception e) { _logger.LogError($"Getting a shipping with id: {id} failed. {e.Message}"); return(new ServiceResult(false, e.Message)); } }