public async Task <IServiceResult> CreateAsync(ShippingDto shippingDto) { try { var shipping = _mapper.Map <ShippingDto, Shipping>(shippingDto); await _repository.AddAsync(shipping); if (!await _unitOfWork.CompleteAsync()) { throw new SaveFailedException(nameof(shipping)); } _logger.LogInformation( $"Added new shippng with id: {shipping.Id} for order with id: {shipping.OrderId}."); var result = await GetSingleAsync(shipping.Id.ToString()); return(new ServiceResult(payload: result.Payload)); } catch (Exception e) { _logger.LogError($"Adding new shipping failed. {e.Message}"); return(new ServiceResult(false, e.Message)); } }