/// <inheritdoc /> public void Edit([NotNull] Action <IExtendedList <T> > updateAction) { if (updateAction == null) { throw new ArgumentNullException(nameof(updateAction)); } lock (_writeLock) { IChangeSet <T> changes = null; _editLevel++; if (_editLevel == 1) { if (_changesPreview.HasObservers) { changes = _readerWriter.WriteWithPreview(updateAction, InvokeNextPreview); } else { changes = _readerWriter.Write(updateAction); } } else { _readerWriter.WriteNested(updateAction); } _editLevel--; if (_editLevel == 0) { InvokeNext(changes); } } }