public bool AddLayer(DataSourceType layerType) { string[] filenames; if (!_fileDialogService.OpenFiles(layerType, out filenames)) { return(false); } BeginBatch(); bool result = false; try { foreach (var name in filenames) { if (AddLayersFromFilename(name)) { result = true; // currently at least one should be success to return success } } } finally { EndBatch(); } return(result); }