private async Task <List <HandlerServiceResult> > ConfigureOperationCategory(string answer, User user) { answer = answer.Trim(); if (string.IsNullOrEmpty(answer)) { return(new List <HandlerServiceResult> { _resultService.BuildEmptyAnswerErrorResult() }); } var userCategories = await _documentServiceHelper.GetUserCategoriesByTypeAsync(user); var category = userCategories.FirstOrDefault(c => c.Name.Equals(answer)); if (category == null) { return(new List <HandlerServiceResult> { _resultService.BuildOperationCategoryNotFoundErrorResult() }); } user.Context.CategoryId = category.Id; var operation = await GetOrCreateOperationAsync(user); operation.CategoryId = category.Id; await _documentServiceHelper.UpdateOperationAsync(operation); user.Context.CurrentNode = user.Context.CurrentNode.Children.FirstOrDefault(); var nextQuestion = await _questionService.BuildQuestion(user); await _userDocumentService.UpdateAsync(user); return(new List <HandlerServiceResult> { nextQuestion }); }