public void LoadExpansionState(ITreeViewModelItem treeViewModelItem)
        {
            var isExpanded = ItemStates.SingleOrDefault(o => o.Item.IsAlive && o.Item.Target.Equals(treeViewModelItem.Value))?.
                             GetExpansionState(treeViewModelItem.GetAncestors().Select(o => o.Value));

            if (isExpanded != null)
            {
                treeViewModelItem.IsExpanded = (bool)isExpanded;
            }
        }
        public void SaveExpansionState(ITreeViewModelItem treeViewModelItem)
        {
            var currentStates = ItemStates.SingleOrDefault(o => o.Item.IsAlive && o.Item.Target.Equals(treeViewModelItem.Value));

            if (currentStates != null)
            {
                currentStates.SetExpansionState(treeViewModelItem.GetAncestors().Select(o => o.Value), treeViewModelItem.IsExpanded);
            }
            else
            {
                var stateRetainer = new ReferenceExpansionRetainer(treeViewModelItem.Value);
                stateRetainer.SetExpansionState(treeViewModelItem.GetAncestors().Select(o => o.Value), treeViewModelItem.IsExpanded);
                ItemStates.Add(stateRetainer);
            }
        }