void SetTreeStateBack(IEnumerable <IExplorerItemModel> expandedList, IExplorerItemModel selectedItem) { if (expandedList != null) { IStudioResourceRepository studioResourceRepository = StudioResourceRepository; foreach (var item in expandedList) { var environment = studioResourceRepository.FindItemById(item.EnvironmentId); if (environment != null) { IExplorerItemModel explorerItem = environment; if (!string.IsNullOrEmpty(item.ResourcePath)) { var strings = item.ResourcePath.Split('\\'); foreach (var s in strings) { if (explorerItem != null) { explorerItem = explorerItem.Children.FirstOrDefault(c => c.DisplayName == s); } } } if (explorerItem != null) { explorerItem.IsExplorerExpanded = true; } } } } if (selectedItem != null) { BringItemIntoView(selectedItem.EnvironmentId, selectedItem.ResourceId); } }