public AddEditExistingControlSystemComponentAlarmPropertyViewModel(ControlSystemComponentType controlSystemEquipmentComponentType)
        {
            //new
            mControlSystemComponentTypeAlarmProperty = new ControlSystemComponentTypeAlarmProperty { ComponentTypeId = controlSystemEquipmentComponentType.Id };

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModify);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true);

            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
            Properties = new List<ControlSystemAlarmProperty>();

            //Load Component types
            EventHandler<GetAllControlSystemAlarmPropertiesCompletedEventArgs> getAllControlSystemAlarmPropertiesCompleted = (s, allEventArgs) =>
                                              {
                                                  cmsWebServiceClient.GetControlSystemComponentTypeAlarmPropertiesCompleted +=
                                                      (s1, e1)
                                                      =>
                                                      {
                                                          List<int> listOfAssignedPropertyIds = new List<int>();
                                                          e1.Result.ForEach(x => listOfAssignedPropertyIds.Add(x.AlarmPropertyId));

                                                          foreach (var componentProperty in allEventArgs.Result)
                                                          {
                                                              if (!listOfAssignedPropertyIds.Contains(componentProperty.Id))
                                                              {
                                                                  Properties.Add(componentProperty);
                                                              }
                                                          }

                                                          if (Properties.Count > 0)
                                                          {
                                                              mControlSystemComponentTypeAlarmProperty.AlarmPropertyId = Properties[0].Id;
                                                              mControlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty = Properties[0];
                                                          }
                                                          Loaded();
                                                      };

                                                  cmsWebServiceClient.GetControlSystemComponentTypeAlarmPropertiesAsync(controlSystemEquipmentComponentType.Id);
                                              };
            cmsWebServiceClient.GetAllControlSystemAlarmPropertiesCompleted += getAllControlSystemAlarmPropertiesCompleted;
            cmsWebServiceClient.GetAllControlSystemAlarmPropertiesAsync();
        }
        private void LoadComponentTypeAlarmProperties(NodeView expandedNode)
        {
            var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            EventHandler<GetControlSystemComponentTypeAlarmPropertiesCompletedEventArgs> fetchCompleted = null;
            fetchCompleted = (s, eventArgs) =>
            {
                var controlSystemEquipmentComponentTypeProperties = eventArgs.Result;
                foreach (var controlSystemComponentTypeAlarmProperty in controlSystemEquipmentComponentTypeProperties)
                {
                    var desc = controlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Name;
                    if (!string.IsNullOrEmpty(controlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Description))
                    {
                        desc = string.Format("{0} ({1})", controlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Name,
                            controlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Description);
                    }

                    var child = new NodeView(expandedNode)
                    {
                        Id = controlSystemComponentTypeAlarmProperty.Id,
                        Name = desc,
                        Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                        Type = NodeType.ControlSystemComponentTypeAlarmProperty,
                        HasChildren = false,
                        SortField = controlSystemComponentTypeAlarmProperty.Ordinal.ToString()
                    };
                    expandedNode.Children.Add(child);
                }
                Utils.HideSpinner(expandedNode);
                expandedNode.Sort();

                cmsWebServiceClient.GetControlSystemComponentTypeAlarmPropertiesCompleted -= fetchCompleted;
            };

            cmsWebServiceClient.GetControlSystemComponentTypeAlarmPropertiesCompleted += fetchCompleted;
            cmsWebServiceClient.GetControlSystemComponentTypeAlarmPropertiesAsync(expandedNode.Parent.Id);
        }