public async Task <Unit> Handle(WriteShortestPathToFileCommand request, CancellationToken cancellationToken) { var words = (await _wordsRepository.GetAll()) .ToList(); _logger.LogDebug($"Find {words.Count} words"); var start = new Word(request.Start); var end = new Word(request.End); _logger.LogDebug($"Build tree node"); var wordsTree = _treeNodeBuilder.BuildTree(start, end, words); _logger.LogDebug($"search shortest path"); var shortestPath = await _searchWordsPath .GetShortestPath(start, end, wordsTree); _logger.LogDebug($"write file output"); _documentListWriter.WriteText(shortestPath); return(Unit.Value); }