private void RefreshAssetsTree()
        {
            if (_model.AssetTypes != null)
            {
                // setup
                var tS = new Dictionary <string, ClassifiedAssetTypesViewModel>();
                // look at classified asset types
                foreach (var assetType in _model.AssetTypes.Where(x => x.Categories != null))
                {
                    var thisCats = assetType.Categories.Where(x => x.Classification == SelectedClassification);

                    foreach (var thisCat in thisCats)
                    {
                        var thisT     = thisCat.Code;
                        var thisCatVm = new ClassifiedAssetTypesViewModel(thisCat);
                        if (!tS.ContainsKey(thisT))
                        {
                            tS.Add(thisT, thisCatVm);
                        }
                        tS[thisT].AssetTypes.Add(new AssetTypeViewModel(assetType));
                    }
                }

                var sorted = new List <ClassifiedAssetTypesViewModel>(tS.Count);
                sorted.AddRange(tS.Keys.OrderBy(x => x).Select(key => tS[key]));

                AssetTypes = new ObservableCollection <ClassifiedAssetTypesViewModel>(sorted);
            }
            else
            {
                AssetTypes = new ObservableCollection <ClassifiedAssetTypesViewModel>();
            }

            if (PropertyChanged != null)
            {
                PropertyChanged.Invoke(this, new PropertyChangedEventArgs(@"AssetTypes"));
            }
        }
        private void RefreshAssetsTree()
        {
            if (_model.AssetTypes != null)
            {
                // setup
                var tS = new Dictionary<string, ClassifiedAssetTypesViewModel>();
                // look at classified asset types
                foreach (var assetType in _model.AssetTypes.Where(x => x.Categories != null))
                {
                    var thisCats = assetType.Categories.Where(x => x.Classification == SelectedClassification);

                    foreach (var thisCat in thisCats)
                    {
                        var thisT = thisCat.Code;
                        var thisCatVm = new ClassifiedAssetTypesViewModel(thisCat);
                        if (!tS.ContainsKey(thisT))
                        {
                            tS.Add(thisT, thisCatVm);
                        }
                        tS[thisT].AssetTypes.Add(new AssetTypeViewModel(assetType));    
                    }
                }

                var sorted  = new List<ClassifiedAssetTypesViewModel>(tS.Count);
                sorted.AddRange(tS.Keys.OrderBy(x => x).Select(key => tS[key]));

                AssetTypes = new ObservableCollection<ClassifiedAssetTypesViewModel>(sorted);
            }
            else
                AssetTypes = new ObservableCollection<ClassifiedAssetTypesViewModel>();

            if (PropertyChanged != null)
                PropertyChanged.Invoke(this, new PropertyChangedEventArgs(@"AssetTypes"));
        }