private void EditComponentHandler(object parameter)
        {
            if (SelectedComponent != null)
            {
                CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

                cmsWebServiceClient.GetCalibrationComponentsCompleted +=
                    (s, e) =>
                    {

                        CalibrationComponent clone = new CalibrationComponent();
                        CommonUtils.CloneObject(clone, SelectedComponent, "");
                        clone.CalibrationComponentType = SelectedComponent.CalibrationComponentType;//not done by CloneObject method.

                        IList<string> existingComponentNames = (from x in Components select x.Name).ToList();
                        AddEditCalibrationComponentDialog dialog = new AddEditCalibrationComponentDialog(mSelectedComponent, existingComponentNames);
                        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;
                                }
                                else
                                {
                                    SelectedComponent.Name = clone.Name;
                                    SelectedComponent.CalibrationComponentType = clone.CalibrationComponentType;
                                    SelectedComponent.Description = clone.Description;
                                    SelectedComponent.Notes = clone.Notes;
                                }

                                RaisePropertyChanged("Components");

                            };
                    };
                cmsWebServiceClient.GetCalibrationComponentsAsync();

            }
        }
        private void DisplayAddComponentDialog()
        {
            IList<string> existingComponentNames = (from x in Components select x.Name).ToList();
            AddEditCalibrationComponentDialog dialog = new AddEditCalibrationComponentDialog(mInstrument.Id, existingComponentNames);
            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.Component != null)
                    {

                        mInstrument.CalibrationComponents.Add(dialog.Component);

                        SelectedComponent = dialog.Component;

                        //OnCalibrationComponentAdded(dialog.Component);

                        RaiseChangeEvent();
                        OnCollectionChanged();
                        RaisePropertyChanged("Components");
                    }
                };
        }