public async Task Put(int id, Order order) { var dbOrder = await _repo.Get(id); if (dbOrder == null) { throw new Exception($"Order with id: {id} does not exist!"); } if (dbOrder.ProcessedAt != null) { throw new Exception("Cannot update an order that has already been processed!"); } await _repo.Put(id, order); }