/// <summary>
        /// Adds a request to run a test case XML file the queue of tasks to run.
        /// </summary>
        public int Add(TaskRequest item)
        {
            Task<SessionRunnerTaskInfo> parentTask = Task.Run(() =>
            {
                var cancelTokenSource = new CancellationTokenSource();
                var cancelToken = cancelTokenSource.Token;

                var taskInfo = new SessionRunnerTaskInfo();
                taskInfo.Request = item;
                taskInfo.StartTime = DateTime.UtcNow;
                taskInfo.Username = item.Username;
                taskInfo.TeamName = item.TeamName;

                Task childTask = Task.Run(() =>
                {
                    StartSession(taskInfo);
                }, cancelToken);

                taskInfo.CancelTokenSource = cancelTokenSource;
                taskInfo.CurrentTask = childTask;

                return taskInfo;
            });

            _currentTasks.Add(parentTask);
            return parentTask.Id;
        }
        /// <summary>
        /// Starts the test case XML file run.
        /// </summary>
        internal void StartSession(SessionRunnerTaskInfo item)
        {
            try
            {
                // TODO: this run could be for a user run only, not the entire team (read the XML from their folder?)
                string username = item.Username;
                string teamName = item.TeamName;

                // Read in the XML file from the team folder, e.g. "c:\testcases\myteam\test1.xml"
                string fullPath = Path.Combine(_appConfig.TestCasesBaseDirectory, teamName, item.Request.Filename);
                string xml = File.ReadAllText(fullPath);

                using (var stringReader = new StringReader(xml))
                {
                    var testCaseReader = new TestCaseReader();
                    CaseCollection caseCollection = testCaseReader.Read(stringReader);
                    var config = new Config();
                    var logStringBuilder = new StringBuilder();
                    var httpLogWriter = new HttpLogWriter(new StringWriter(logStringBuilder));
                    var httpClient = new HttpClient(httpLogWriter, new RestClient());

                    var runner = new TestSessionRunner(config, httpClient, new TextFileResultWriter());
                    item.Runner = runner;
                    runner.Run(caseCollection);
                }
            }
            catch (Exception e)
            {
                item.Errors = e.ToString();
            }
        }