public IThemeEditorViewModel OpenMasterThemeForScript(IItemFilterScriptViewModel scriptViewModel) { var existingMasterThemeViewModelCount = OpenDocuments.OfType <IThemeEditorViewModel>() .Count(c => c.IsMasterThemeForScript == scriptViewModel.Script); if (existingMasterThemeViewModelCount > 0) { return(OpenDocuments.OfType <IThemeEditorViewModel>() .First(c => c.IsMasterThemeForScript == scriptViewModel.Script)); } return(null); }