public DesignMainViewModel(IReportingService reportingService, IReportDesignerService designerService, IReportRepository reprepo)
 {
     this.reportingService = reportingService;
     this.designerService  = designerService;
     this.reprepo          = reprepo;
     CreateCommand         = new DelegateCommand(ExecuteCreate);
     CreateWithCommand     = new DelegateCommand <object>(ExecuteCreateWith);
     EditCommand           = new DelegateCommand(ExecuteEdit, CanExecuteEdit);
     DeleteCommand         = new DelegateCommand(ExecuteDelete, CanExecuteDelete);
     BackCommand           = new DelegateCommand(ExecuteBack);
     ReportTypesMessage    = "Installed Report Types";
     ScreenState           = ScreenStates.HomeState;
     ReportTypesCV         = CollectionViewSource.GetDefaultView(reportingService.AvailableReportTypes);
     DesignersCV           = CollectionViewSource.GetDefaultView(designerService.AvailableReportDesigners);
     ReportTypesCV.MoveCurrentTo(null);
     DesignersCV.MoveCurrentTo(null);
     ReportTypesCV.CurrentChanged += ReportTypesCV_CurrentChanged;
 }
        private async void ExecuteBack()
        {
            await reprepo.SaveAsync(ActiveDesigner.ReportDefinition);

            await reprepo.SaveScriptAsync(ActiveDesigner.ReportDefinition.ID, ActiveDesigner.ReportDefinition.Script);

            int index = Reports.IndexOf(ActiveDesigner.ReportDefinition);

            if (index != -1)
            {
                Reports.RemoveAt(index);
                Reports.Insert(index, ActiveDesigner.ReportDefinition);
            }

            ActiveDesigner = null;
            ScreenState    = ScreenStates.HomeState;
            ReportTypesCV.MoveCurrentTo(null);
            OnPropertyChanged(() => Reports);
            raise();
            //loadReports();
        }