private void DeleteCommandHandler(object parameter)
 {
     var popupDialog = new AddControlSystemRevisionHistoryDialog(ControlSystem.Id, ControlSystem.Name);
     popupDialog.Show();
     popupDialog.Closed +=
         (s2, e2) =>
         {
             if (popupDialog.DialogResult.HasValue && popupDialog.DialogResult.Value)
             {
                 var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
                 cmsWebServiceClient.SaveIsActiveEquipmentStateCompleted += (s, e) =>
                 {
                     //Calls MainPage.CloseTab()
                     EventAggregator.GetEvent<PrismEvents.CloseTabPrismEvent>().Publish(new QuickControlSystem {Id = ControlSystem.Id, Name = ControlSystem.Name});
                     EventAggregator.GetEvent<PrismEvents.RefreshNavigationEvent>().Publish(new QuickControlSystem());
                 };
                 cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.Control, ControlSystem.Id, false, CMS.User.Id);
             }
         };
 }
        public void Save(Action<bool> saved)
        {
            var validationErrors = GetErrors();

            if (validationErrors.Any())
            {
                View.ValidationPopup.Show(validationErrors);
            }
            else
            {
                var dialog = new AddControlSystemRevisionHistoryDialog(ControlSystem.Id, ControlSystem.Name);
                dialog.Show();

                dialog.Closed +=
                    (s1, e1) =>
                    {
                        if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                        {
                            IsInSavingMode = true;
                            SaveCommand.RaiseCanExecuteChanged();

                            var componentsControl = View.ComponentsTab.Content as ControlSystemComponentsControl;

                            if (componentsControl != null)
                            {
                                //SAVE COMP
                                var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
                                cmsWebServiceClient.SaveControlSystemComponentsCompleted += (s2, e2) =>
                                {
                                    if (e2.Result.HasErrors)
                                    {
                                        //val popup..
                                        View.ValidationPopup.Show(Utils.BuildValidationResultFromServerErrors("Move Component Failed", e2.Result.ServerErrorMessages));
                                    }
                                    else
                                    {
                                        BuildMoveComponentRevisionHistory(componentsControl);
                                        //save actual equipment 2nd
                                        SaveControlSystem(saved);
                                    }
                                };

                                //save any component moves 1st
                                cmsWebServiceClient.SaveControlSystemComponentsAsync(componentsControl.Model.MovedComponents);
                            }
                        }
                    };
            }
        }