private async Task <List <HandlerServiceResult> > ConfigureStatsCategory(string answer, User user)
        {
            answer = answer.Trim();

            if (string.IsNullOrEmpty(answer))
            {
                return(new List <HandlerServiceResult>
                {
                    _resultService.BuildEmptyAnswerErrorResult()
                });
            }

            var categories = await _categoryDocumentService.GetByUserIdAsync(user.Id);

            var category = categories.FirstOrDefault(c => c.Name.Equals(answer));

            if (category == null)
            {
                return(new List <HandlerServiceResult>
                {
                    _resultService.BuildCategoryNotFoundErrorResult()
                });
            }

            user.Context.CategoryId  = category.Id;
            user.Context.CurrentNode = user.Context.CurrentNode.Children.FirstOrDefault();

            await _userDocumentService.UpdateAsync(user);

            return(new List <HandlerServiceResult>
            {
                await _questionService.BuildQuestion(user)
            });
        }
        private async Task <List <HandlerServiceResult> > ConfigureCategoryEdit(string answer, User user)
        {
            answer = answer.Trim();

            List <HandlerServiceResult> result;

            var categories = await _categoryDocumentService.GetByUserIdAsync(user.Id);

            var categoryToEdit = categories.FirstOrDefault(c => c.Name.Equals(answer));

            if (categoryToEdit != null)
            {
                user.Context.CurrentNode = user.Context.CurrentNode.Children.FirstOrDefault();
                user.Context.CategoryId  = categoryToEdit.Id;

                result = new List <HandlerServiceResult>
                {
                    await _questionService.BuildQuestion(user)
                };
            }
            else
            {
                user.Context.CurrentNode.Question = QuestionsEnum.None;

                user.Context.CategoryId = null;

                result = new List <HandlerServiceResult>
                {
                    _resultService.BuildCategoryNotFoundErrorResult()
                };
            }

            await _userDocumentService.UpdateAsync(user);

            return(result);
        }