void EditAnObject(ObjectBase anObject)
{
    using(anObject.BeginEdit(UndoLevelAction.Revert))
    {
        //...perform operations on the object.
        anObject.CommitEdit();  //explicitly commit the changes.
    }   //when UndoLevel goes out of scope, nothing happens, because changes have already been committed.
            
    using(anObject.BeginEdit(UndoLevelAction.Revert))
    {
        //...perform operations on the object.
        //...No explicit Commit or Undo call.
    }   //when UndoLevel goes out of scope, the UndoLevel calls UndoEdit to revert the changes.
}