private void AddExistingMobilePlantComponentProperty(NodeView nodeView)
        {
            int electricalEquipmentComponentTypeId = nodeView.Id;
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            cmsWebServiceClient.GetMobilePlantComponentTypeCompleted +=
                (s, e) =>
                {
                    AddEditExistingMobilePlantComponentPropertyDialog dialog = new AddEditExistingMobilePlantComponentPropertyDialog(e.Result);
                    dialog.Show();

                    dialog.Closed += (s1, e1) =>
                    {

                        if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                        {
                            EventHandler<AddMobilePlantComponentTypePropertyCompletedEventArgs> addCompleted = null;
                            addCompleted = (s2, eventArgs) =>
                            {
                                MobilePlantComponentTypeProperty pcpt = eventArgs.Result;

                                if (pcpt != null)
                                {
                                    NodeView child = new NodeView(nodeView)
                                    {
                                        Id = pcpt.Id,
                                        Name = dialog.MobilePlantComponentTypeProperty.MobilePlantProperty.Name,
                                        Description = dialog.MobilePlantComponentTypeProperty.MobilePlantProperty.Description,
                                        Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                                        Type = NodeType.MobilePlantComponentTypeProperty,
                                        HasChildren = false,
                                        SortField = dialog.MobilePlantComponentTypeProperty.Ordinal.ToString()
                                    };
                                    if (nodeView.ChildrenLoaded)
                                    {
                                        nodeView.Children.Add(child);
                                        nodeView.Sort();
                                    }
                                }

                                cmsWebServiceClient.AddMobilePlantComponentTypePropertyCompleted -= addCompleted;

                            };

                            cmsWebServiceClient.AddMobilePlantComponentTypePropertyCompleted += addCompleted;

                            MobilePlantComponentTypeProperty electricalEquipmentComponentTypeProperty = new MobilePlantComponentTypeProperty
                            {
                                MobilePlantComponentTypeId = electricalEquipmentComponentTypeId,
                                MobilePlantPropertyId = dialog.MobilePlantComponentTypeProperty.MobilePlantPropertyId,
                                Ordinal = dialog.MobilePlantComponentTypeProperty.Ordinal
                            };

                            cmsWebServiceClient.AddMobilePlantComponentTypePropertyAsync(electricalEquipmentComponentTypeProperty);
                        }
                    };
                };

            cmsWebServiceClient.GetMobilePlantComponentTypeAsync(electricalEquipmentComponentTypeId);
        }
        private void EditMobilePlantComponentTypeProperty(NodeView nodeView)
        {
            AddEditExistingMobilePlantComponentPropertyDialog dialog = new AddEditExistingMobilePlantComponentPropertyDialog(nodeView.Id);

            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
                        EventHandler<AddUpdateMobilePlantComponentTypePropertyCompletedEventArgs> addCompleted = null;
                        addCompleted = (s2, eventArgs) =>
                        {
                            MobilePlantComponentTypeProperty pcpt = eventArgs.Result;

                            if (pcpt != null)
                            {
                                nodeView.Name = dialog.MobilePlantComponentTypeProperty.MobilePlantProperty.Name;
                                nodeView.Description = dialog.MobilePlantComponentTypeProperty.MobilePlantProperty.Description;
                                nodeView.SortField = dialog.MobilePlantComponentTypeProperty.Ordinal.ToString();
                            }

                            cmsWebServiceClient.AddUpdateMobilePlantComponentTypePropertyCompleted -= addCompleted;
                        };

                        cmsWebServiceClient.AddUpdateMobilePlantComponentTypePropertyCompleted += addCompleted;

                        MobilePlantComponentTypeProperty MobilePlantComponentTypeProperty = new MobilePlantComponentTypeProperty
                        {
                            MobilePlantComponentTypeId = dialog.MobilePlantComponentTypeProperty.MobilePlantComponentTypeId,
                            MobilePlantPropertyId = dialog.MobilePlantComponentTypeProperty.MobilePlantPropertyId,
                            Ordinal = dialog.MobilePlantComponentTypeProperty.Ordinal
                        };

                        cmsWebServiceClient.AddUpdateMobilePlantComponentTypePropertyAsync(MobilePlantComponentTypeProperty);
                    }

                    nodeView.Parent.Sort();

                };
            dialog.Show();
        }