public void FullfillCommitmentAtomic(int amountToCommit) { if (amountToCommit > amount) { throw new InventoryException("Cannot move more than there is in commitment!" + "Currently committing: " + amountToCommit + " but only committed to: " + amount); } committer.RemoveCommitment(this); committedTo.RemoveCommitment(this); committer.RemoveFromCurrentAmount(itemType, amountToCommit); committedTo.AddToCurrentAmount(itemType, amountToCommit); if (amountToCommit < amount) { var newCommittment = new Commitment(amount - amountToCommit, itemType, committedTo, committer); newCommittment.CommitToComitterAndComitee(); } }