private void ProcessingRecurrent(BlogsProcessingStructure bps, int level = 0)
        {
            var posts = ((level == 0)
                        ? bps.InputParams4Blogs.InputXml.GetMultiNodes(bps.Xpath4SelectPosts)
                        : bps.InputParams4Blogs.InputXml.XPathSelectElements(bps.Xpath4SelectPosts)).ToArray();

            foreach (var post in posts)
            {
                //1.
                var body = post.GetSingleNode(BlogsConsts.BODY).Value;
                if (body.IsEmptyOrNull())
                {
                    continue;
                }

                bps.TMInputParamsWithInquiriesSynonyms.InputText = body;

                var continueProcessing = true;
                var tmResult           = _TonalityMarking.ExecuteTonalityMarking(bps.TMInputParamsWithInquiriesSynonyms);
                if (tmResult.InquiryAllocateStatus == InquiryAllocateStatus.NotAllocated)
                {
                    if (level == 0)
                    {
                        continue;
                    }

                    bps.TMInputParamsWithoutInquiriesSynonyms.InputText = tmResult.OutputXml;

                    tmResult = _TonalityMarking.ExecuteTonalityMarking(bps.TMInputParamsWithoutInquiriesSynonyms);
                    if (tmResult.InquiryAllocateStatus == InquiryAllocateStatus.NotAllocated)
                    {
                        continue;
                    }
                    continueProcessing = false;
                }

                //2.
                var outputXml = default(string);
                switch (bps.InputParams4Blogs.OutputBlogsFormat)
                {
                case OutputBlogsFormat.LinguisticXml:
                    outputXml = tmResult.OutputXml;
                    break;

                case OutputBlogsFormat.Offsets:
                    var offsetsProcessor = new OffsetsProcessor(/*body*/);
                    var offsets          = offsetsProcessor.CreateOffsetsString(tmResult.GetOutputXDocument().Root);
                    outputXml = offsets;
                    break;

                default: throw (new ArgumentException(bps.InputParams4Blogs.OutputBlogsFormat.ToString()));
                }

                //3.
                var id = post.GetSingleNode(BlogsConsts.ID).Value;
                //var parent = post.GetSingleNode( BlogsConsts.PARENT ).Value;
                //var level  = post.GetSingleNode( BlogsConsts.LEVEL  ).Value;

                var tuple = new TonalityMarkingTuple4Blogs
                            (
                    id,
                    outputXml,
                    bps.InputParams4Blogs.OutputBlogsFormat,
                    tmResult.AuthorTonalityMarkingTuple.Positive,
                    tmResult.AuthorTonalityMarkingTuple.Negative,
                    tmResult.AuthorTonalityMarkingTuple.Objects //GetOutputXmlXDocument().ExtractObjects()
                            );
                bps.Tuples.Add(tuple);

                //4.
                if (continueProcessing)
                {
                    bps.Xpath4SelectPosts = BlogsConsts.POSTS_FORMAT_XPATH.FormatEx(level + 1, id);
                    ProcessingRecurrent(bps, level + 1);
                }
            }
        }
        private PairTPL PostProcessing(XElement post, ParallelLoopState loopstate, PairTPL p)
        {
            if (p == null)
            {
                Debugger.Break();
            }

            //1. - paralell
            var body = post.GetSingleNode(BlogsConsts.BODY).Value;

            if (body.IsEmptyOrNull())
            {
                return(p);
            }

            var continueProcessing = true;
            var tmResult           = _TonalityMarking.ExecuteTonalityMarking(p.bps.CreateTMInputParamsYesInquiries(body));

            if (tmResult.InquiryAllocateStatus == InquiryAllocateStatus.NotAllocated)
            {
                if (p.pps.Level == 0)
                {
                    return(p);
                }

                tmResult = _TonalityMarking.ExecuteTonalityMarking(p.bps.CreateTMInputParamsNoInquiries(tmResult));
                if (tmResult.InquiryAllocateStatus == InquiryAllocateStatus.NotAllocated)
                {
                    return(p);
                }
                continueProcessing = false;
            }

            //2.
            var outputXml = default(string);

            switch (p.bps.InputParams4Blogs.OutputBlogsFormat)
            {
            case OutputBlogsFormat.LinguisticXml:
                outputXml = tmResult.OutputXml;
                break;

            case OutputBlogsFormat.Offsets:
                var offsetsProcessor = new OffsetsProcessor(/*body*/);
                var offsets          = offsetsProcessor.CreateOffsetsString(tmResult.GetOutputXDocument().Root);
                outputXml = offsets;
                break;

            default: throw (new ArgumentException(p.bps.InputParams4Blogs.OutputBlogsFormat.ToString()));
            }

            //3.
            var id = post.GetSingleNode(BlogsConsts.ID).Value;
            //var parent = post.GetSingleNode( BlogsConsts.PARENT ).Value;
            //var level  = post.GetSingleNode( BlogsConsts.LEVEL  ).Value;
            var tuple = new TonalityMarkingTuple4Blogs
                        (
                id,
                outputXml,
                p.bps.InputParams4Blogs.OutputBlogsFormat,
                tmResult.AuthorTonalityMarkingTuple.Positive,
                tmResult.AuthorTonalityMarkingTuple.Negative,
                tmResult.AuthorTonalityMarkingTuple.Objects //GetOutputXmlXDocument().ExtractObjects()
                        );

            p.bps.Tuples.Add(tuple);

            //4.
            if (continueProcessing)
            {
                ProcessingRecurrent(p.Create(id));
            }

            return(p);
        }