private async Task DeleteScriptService(ScriptService scriptService) {
            if (!await _dialogService.Confirm(Novaroma.Properties.Resources.MontyNi, Novaroma.Properties.Resources.AreYouSure))
                return;

            await _engine.DeleteEntity(scriptService);
            _scriptServices.Remove(scriptService);
            IsModified = true;
        }
        public ScriptServiceWindow(IDialogService dialogService, ScriptService scriptService) {
            _dialogService = dialogService;
            InitializeComponent();

            DataContext = this;

            ScriptName = scriptService.Name;
            CodeEditor.Text = scriptService.Code;

            Closing += OnClosing;
        }
        private async void AddButton_OnClick(object sender, RoutedEventArgs e) {
            var window = new ScriptServiceWindow(_dialogService);
            var result = window.ShowDialog();
            if (result.HasValue && result.Value) {
                var scriptService = new ScriptService();
                scriptService.Name = window.ScriptName;
                scriptService.Code = window.Code;

                await _engine.InsertEntity(scriptService);
                ScriptServices.Add(scriptService);
                IsModified = true;
            }
        }