private void UpdateUserQuery(Query query)
        {
            var configuration = this.configurationService.GetConfiguration();
            var queryToUpdate = configuration.UserQueries.First(q => q.Id == query.Id);

            queryToUpdate.Name = query.Name;
            queryToUpdate.Value = query.Value;

            this.configurationService.SaveConfiguration(configuration);
        }
        public QueryTreeViewModel(Query query, QueryTreeViewModelCommands queryTreeViewModelCommands)
        {            
            this.query = query;
            this.queryTreeViewModelCommands = queryTreeViewModelCommands;

            if (query.Children != null)
            {
                this.children = new ObservableCollection<QueryTreeViewModel>(query.Children.Select(q => new QueryTreeViewModel(q, queryTreeViewModelCommands)).ToList());
            }
        }
        public void AddUserQuery(Query query)
        {
            var configuration = this.configurationService.GetConfiguration();

            if (configuration.UserQueries == null)
            {
                configuration.UserQueries = new List<Query>();
            }

            configuration.UserQueries.Add(query);
            this.configurationService.SaveConfiguration(configuration);
        }
        public void AddOrUpdateQuery(Query query)
        {
            var configuration = this.configurationService.GetConfiguration();

            if (configuration.UserQueries.Any(q => q.Id == query.Id))
            {
                this.UpdateUserQuery(query);
            }
            else
            {
                this.AddUserQuery(query);
            }
        }
 public AddEditQueryViewModel(IQueryService queryService, Query query, Action successCallback)
 {
     this.queryService = queryService;
     this.successCallback = successCallback;
     this.query = query;
 }
 public void ShowEditDialog(Query queryToEdit, Action successCallback)
 {
     this.InitializeViewModels(this.viewModelFactory(queryToEdit, successCallback));
     this.ShowDialog();
 }