private PropertyChange Undo(IDbEntity e, PropertyChange lastChange)
 {
     if (!lastChange.IsOrphan(e) ||
         (lastChange.IsDbEntityEnumerable && lastChange.After == null && lastChange.Before != null))
     {
         lastChange.Revert(e);
     }
     return(MoveLastChange(lastChange));
 }
        private PropertyChange Redo(IDbEntity e, PropertyChange lastChange)
        {
            if (!lastChange.IsOrphan(e) ||
                (lastChange.IsDbEntityEnumerable && lastChange.After != null && lastChange.Before == null))
            {
                lastChange.Apply(e);
            }
            _lastChange = lastChange;
            PropertyChange nextChange = null;

            if (!_lastChange.Equals(_changes.Last()))
            {
                nextChange = _changes[_changes.IndexOf(_lastChange) + 1];
            }
            return(nextChange);
        }