public bool Save() { if (Dirty) { if (FilePath == null) { var d = new SaveFileDialog(); d.Filter = Filter; if (d.ShowDialog(OwnerForm) != DialogResult.OK) { return(false); } FilePath = d.FileName; } using (var stm = new FileStream(FilePath, FileMode.Create)) { DocumentData.Write(stm); } Dirty = false; } return(true); }