public void SaveSelections(IEnumerable <QualifiedModuleName> modules) { _savedSelections.Clear(); var openModules = _selectionService.OpenModules(); foreach (var module in modules.Where(module => openModules.Contains(module)).Distinct()) { var selection = _selectionService.Selection(module); if (selection.HasValue) { _savedSelections.Add(module, selection.Value); } } }