private void Insert_Impl() { var newNote = new ShowLightViewModel(InsertColor, (int)(InsertTime * 1000f)); UndoManager.AddDelegateUndo( "Insert", undoAction: () => { Showlights.Remove(newNote); return(newNote); }, redoAction: () => { Showlights.AddOrUpdate(newNote); return(newNote); }, FileDirty); Showlights.AddOrUpdate(newNote); SelectedItem = newNote; scrollIntoView.OnNext(newNote); }