public async Task <IActionResult> Create([Required][FromBody] CreateSearchQueryOptions options)
        {
            var id = await this.queries.CreateQueryAsync(options);

            //await this.queries.RefreshAsync(id);
            var query = await this.queries.GetDetailAsync(id);

            return(this.Ok(query));
        }
        public async Task <Guid> CreateQueryAsync(CreateSearchQueryOptions options)
        {
            var query = new SearchQuery
            {
                Name     = $"Unnamed Query ({options.SearchTerm})",
                Criteria = new SearchCriteria
                {
                    WithAllTheseWords = options.SearchTerm
                },
                User     = await this.data.GetOrCreateUserReferenceAsync(this.identity),
                Settings = new SearchSettings
                {
                    Priority = Priority.High,
                    AutoFilterDeletedDuplicates = true
                }
            };

            this.data.SearchQueries.Add(query);
            await this.data.SaveChangesAsync();

            return(query.Id);
        }