public async Task UpdateOrderStatusAsync(Guid orderId, OrderStatusUpdate orderStatusUpdateModel) { var order = await _orderRepository.GetOrderByIdAsync(orderId); if (order == null) { throw new KeyNotFoundException("Order Id does not exist"); } if (!orderStatusUpdateModel.StatusId.HasValue || !await _orderStatusRepository.DoesOrderStatusIdExistAsync(orderStatusUpdateModel.StatusId.Value)) { throw new ArgumentException("Status Id is invalid", "statusId"); } order.StatusId = orderStatusUpdateModel.StatusId.Value.ToByteArray(); await _orderRepository.UpdateOrder(); }