public Task <Unit> Handle(ConvertToXMLCommand request, CancellationToken cancellationToken)
        {
            using (XmlWriter writer = XmlWriter.Create(request.FilePath))
            {
                Text text = TextModelBuilder.Build(request.Text);

                writer.WriteStartDocument(true);
                writer.WriteStartElement("text");

                foreach (Sentence sentence in text.Sentences)
                {
                    writer.WriteStartElement("sentence");

                    foreach (Word word in sentence.Words)
                    {
                        writer.WriteElementString("word", word.Value);
                    }

                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
                writer.WriteEndDocument();
            }

            return(Task.FromResult(Unit.Value));
        }
        public Task <Unit> Handle(ConvertToCSVCommand request, CancellationToken cancellationToken)
        {
            using (var writer = new StreamWriter(request.FilePath))
            {
                Text text = TextModelBuilder.Build(request.Text);

                var maxWordsCount = text.Sentences
                                    .Select(s => s.Words.Count)
                                    .Max();

                string header  = CreateHeader(maxWordsCount);
                string records = CreateRecords(text.Sentences);

                writer.WriteLine(header);
                writer.Write(records);
            }

            return(Task.FromResult(Unit.Value));
        }