private void EditComponentHandler(object parameter)
        {
            if (SelectedComponent != null)
            {
                mClone = BuildClone(SelectedComponent);

                IList<string> existingComponentsNames = (from x in Components select x.Name).ToList();
                var dialog = new AddEditControlSystemComponentDialog(SelectedComponent, existingComponentsNames);
                dialog.Show();

                //Select the component as user might have changed the component type
                //and this needs to reload the component type properties
                dialog.Closed += (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        SelectedComponent = dialog.Component;
                        if (SelectedComponent.ControlSystemComponentTypeId != mClone.ControlSystemComponentTypeId)
                        {
                            mComponentTypeChanged = true;
                        }
                        Utils.OnCollectionChanged(EventAggregator, ControlSystem, PROPERTYNAME, true);
                    }
                    else
                    {
                        SelectedComponent.Name = mClone.Name;
                        SelectedComponent.ControlSystemComponentType = mClone.ControlSystemComponentType;
                        SelectedComponent.ControlSystemComponentTypeId = mClone.ControlSystemComponentTypeId;
                        SelectedComponent.Description = mClone.Description;
                    }

                    RaisePropertyChanged("Components");
                    RaisePropertyChanged("SelectedComponent");
                };
            }
        }
        private void DisplayAddComponentDialog()
        {
            IList<string> existingComponentsNames = (from x in Components select x.Name).ToList();

            var dialog = new AddEditControlSystemComponentDialog(ControlSystem.Id, existingComponentsNames);
            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.Component != null)
                    {
                        ControlSystem.ControlSystemComponents.Add(dialog.Component);

                        RaiseChangeEvent();
                        OnCollectionChanged();
                        SelectedComponent = null;
                        RaisePropertyChanged("Components");
                        RaisePropertyChanged("SelectedComponent");
                    }
                };
        }