public async Task <int> RunAsync(string queryGroupName, string query, CancellationToken cancelToken)
        {
            _outputTraceInformation = new OutputTraceInformation();

            //execute th interpretor and run against cosmos and connection
            if (SelectedConnection is Connection && SelectedConnection != null)
            {
                _variables.Clear();

                var documentStore = _clientConnectionManager.CreateDocumentClientAndStore(SelectedConnection);
                //get each query and run it aggregating the results
                var queries = _queryManager.ConveryQueryTextToQueryParts(query);

                var hasNonTransactionDelete = queries.Any(q => q.CleanQueryType == Constants.QueryParsingKeywords.DELETE && !q.IsTransaction);
                //check all the queries for deletes without transactions
                if (hasNonTransactionDelete && !_options.IgnorePrompts)
                {
                    _console.WriteLine("Are you sure you want to delete documents without a transaction. This can not be undone? (Y/N): ");
                    if (_console.ReadLine() == "N")
                    {
                        return(-99);
                    }
                }

                var hasResults = false;
                var hasError   = false;
                //_source = new CancellationTokenSource();
                for (var i = 0; i < queries.Length; i++)
                {
                    var queryParts = queries[i];
                    var runner     = _queryRunners.FirstOrDefault(f => f.CanRun(queryParts));
                    if (runner != null)
                    {
                        var queryIndex = i + 1;
                        if (queries.Length > 1)
                        {
                            WriteHeader('/', 250, $"{queryGroupName} - Query statement {queryIndex}");
                        }

                        var response = await runner.RunAsync(documentStore, SelectedConnection, queryParts, true, _logger, cancelToken, _variables);

                        var querySummaryRecord = new OutputSummaryRecord
                        {
                            CollectionName      = queryParts.CollectionName,
                            Query               = queryParts.ToRawQuery(),
                            QueryStatementIndex = queryIndex
                        };
                        _outputTraceInformation.OutputSummaryRecords.Add(querySummaryRecord);
                        if (!response.success)
                        {
                            //on error stop loop and return
                            querySummaryRecord.HasError = hasError = true;
                            if (!_options.ContinueOnError)
                            {
                                break;
                            }
                        }
                        else if (response.results != null)
                        {
                            querySummaryRecord.ResultCount = response.results.Count;
                            //add a header row if more then 1 query needs to be ran
                            await RenderResults(response.results, queryParts.CollectionName, queryParts, queries.Length > 1, queryIndex);

                            hasResults = true;
                        }
                    }
                    else
                    {
                        //if we have comments then we can assume the whole query is a comment so skip and goto next
                        if (!queryParts.IsCommentOnly)
                        {
                            _logger.LogError($"Unable to find a query processor for query type. query: {queryParts.CleanOrginalQuery}");
                            //on error stop loop and return
                            hasError = true;
                            if (!_options.ContinueOnError)
                            {
                                break;
                            }
                        }
                    }
                }

                await WriteResults();

                if (hasError && !_options.ContinueOnError)
                {
                    //make sure process exits with non zero
                    return(-999);
                }
            }
            else
            {
                _logger.LogError("Invalid connection. Please select a valid connection and try again", "Data Connection Error");
                return(-99);
            }
            return(0);//success
        }