private void EditType(NodeView nodeView)
        {
            AddEditElectricalEquipmentTypeDialog dialog = new AddEditElectricalEquipmentTypeDialog(nodeView.Id);
            dialog.Title = "Edit Electrical Equipment Type";
            dialog.Show();

            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        nodeView.Name = dialog.ElectricalEquipmentType.Name;
                        nodeView.Description = dialog.ElectricalEquipmentType.Description;
                        nodeView.SortField = dialog.ElectricalEquipmentType.Ordinal.ToString();
                        nodeView.IsActive = dialog.ElectricalEquipmentType.IsActive;
                        nodeView.Parent.Sort(true);
                    }
                };
        }
        private void AddType(NodeView nodeView)
        {
            AddEditElectricalEquipmentTypeDialog dialog = new AddEditElectricalEquipmentTypeDialog();
            AddEditElectricalEquipmentTypeModel model = new AddEditElectricalEquipmentTypeModel();
            model.View = dialog;
            dialog.DataContext = model;
            dialog.Show();

            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        NodeView child = new NodeView(nodeView)
                        {
                            Id = dialog.ElectricalEquipmentType.Id,
                            Name = dialog.ElectricalEquipmentType.Name,
                            Description = dialog.ElectricalEquipmentType.Description,
                            Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                            Type = NodeType.ElectricalTypeNode,
                            HasChildren = true,
                            SortField = dialog.ElectricalEquipmentType.Ordinal.ToString(),
                            IsActive = dialog.ElectricalEquipmentType.IsActive

                        };
                        if (nodeView.ChildrenLoaded)
                        {
                            nodeView.Children.Add(child);
                            nodeView.Sort(true);
                        }
                    }
                };
        }