public void AddMovement(ProductMovement movement) { using (var transaction = new TransactionScope()) using (var connection = new ConnectionScope()) { var product = GetProduct(movement.ProductId); if (product == null) throw new Exception("Product not found"); if (product.QuantityOnHand + movement.Quantity < 0) throw new Exception("Quantity on hand cannot become negative."); movement.Insert(); product.QuantityOnHand += movement.Quantity; product.Update(); transaction.Complete(); } }