public void NewNote(NoteType type) { INote note = null; if (type == NoteType.RichText) { note = factory.CreateRichTextNote(); } else if (type == NoteType.ToDo) { note = factory.CreateToDoListNote(); } else { throw new NotImplementedException("Note type not implemented."); } repository.AddOrUpdate(note); OnNoteAdded(note); }