public IEnumerable <IResult> SaveAs(PanelViewModel document, bool quickSave, Action <string> fileSelected) { if (quickSave && !string.IsNullOrEmpty(document.FilePath)) { fileSelected(document.FilePath); } else { var result = resultFactory.ShowFileDialog("Save Cockpit file", fileFilter, FileDialogMode.Save, document.FilePath); yield return(result); if (!string.IsNullOrEmpty(result.File)) { fileSelected(result.File); } else { yield return(resultFactory.Cancel()); } } }