public virtual void Clear() { if (Model.IsTransactional && Model.CurrentTransaction == null) { throw new Exception("Operation out of transaction"); } if (!OwningEntity.Activated) { Model.Activate(OwningEntity); } var oldItems = Internal.ToArray(); Action doAction = () => { Internal.Clear(); NotifyCollectionChanged(NotifyCollectionChangedAction.Reset); NotifyCountChanged(); }; if (!Model.IsTransactional) { doAction(); return; } Action undoAction = () => { Internal.AddRange(oldItems); NotifyCollectionChanged(NotifyCollectionChangedAction.Add, oldItems); NotifyCountChanged(); }; Model.CurrentTransaction.DoReversibleAction(doAction, undoAction, OwningEntity, ChangeType.Modified, Property); }