public async Task <List <HandlerServiceResult> > Handle(Message message) { var user = await _userDocumentService.GetByChatId(message.UserInfo.ChatId); if (user.Context?.CategoryId != null) { var category = await _categoryDocumentService.GetByIdAsync(user.Context.CategoryId); if (!category.Configured) { await _categoryDocumentService.DeleteAsync(user.Context.CategoryId); } } if (user.Context?.OperationId != null) { var operation = await _operationDocumentService.GetByIdAsync(user.Context.OperationId); if (!operation.Configured) { await _operationDocumentService.DeleteAsync(user.Context.OperationId); } } if (user.Context == null) { user.Context = new Context(); } user.Context.CurrentNode = null; user.Context.CategoryId = null; user.Context.OperationId = null; await _userDocumentService.UpdateAsync(user); return(new List <HandlerServiceResult> { new HandlerServiceResult { Message = "Command cancelled.", StatusCode = StatusCodeEnum.Ok } }); }