public override void VisitSectionTitle(SectionTitle sectionTitle)
        {
            // Generate an anchor for all top level section titles
            if (_document.IndexOf(sectionTitle) == 0 && !sectionTitle.Attributes.HasAnchor)
            {
                var builder = new StringBuilder();
                using (var writer = new AsciiDocVisitor(new StringWriter(builder))) writer.VisitInlineContainer(sectionTitle);

                var title = builder.ToString().PascalToHyphen();
                sectionTitle.Attributes.Add(new Anchor(title));
            }

            if (sectionTitle.Attributes.HasAnchor)
            {
                // Check for duplicate ids across documents
                var key = sectionTitle.Attributes.Anchor.Id;
                if (Ids.TryGetValue(key, out var existingFile))
                {
                    throw new Exception($"duplicate id {key} in {_destination.FullName}. Id already exists in {existingFile}");
                }

                Ids.Add(key, _destination.FullName);
            }

            base.VisitSectionTitle(sectionTitle);
        }
        public override void VisitContainer(Container elements)
        {
            if (_topLevel)
            {
                _topLevel = false;
                for (var index = 0; index < elements.Count; index++)
                {
                    var element = elements[index];
                    var source  = element as Source;

                    if (source != null)
                    {
                        // remove empty source blocks
                        if (string.IsNullOrWhiteSpace(source.Text))
                        {
                            continue;
                        }

                        var method = source.Attributes.OfType <NamedAttribute>().FirstOrDefault(a => a.Name == "method");
                        if (method == null)
                        {
                            _newDocument.Add(source);
                            continue;
                        }

                        // if there is a section title since the last source block, don't add one
                        var lastSourceBlock  = _newDocument.LastOrDefault(e => e is Source);
                        var lastSectionTitle = _newDocument.OfType <SectionTitle>().LastOrDefault(e => e.Level == _topSectionTitleLevel + 1);
                        if (lastSourceBlock != null && lastSectionTitle != null)
                        {
                            var lastSectionTitleIndex = _newDocument.IndexOf(lastSectionTitle);
                            var lastSourceBlockIndex  = _newDocument.IndexOf(lastSourceBlock);
                            if (lastSectionTitleIndex > lastSourceBlockIndex)
                            {
                                _newDocument.Add(source);
                                continue;
                            }
                        }

                        switch (method.Value)
                        {
                        case "fluent":
                        case "queryfluent":
                        case "fluentaggs":
                            if (!LastSectionTitleMatches(text => text.StartsWith("Fluent DSL", StringComparison.OrdinalIgnoreCase)))
                            {
                                _newDocument.Add(CreateSubsectionTitle("Fluent DSL example"));
                            }

                            _newDocument.Add(source);
                            break;

                        case "initializer":
                        case "queryinitializer":
                        case "initializeraggs":
                            _newDocument.Add(CreateSubsectionTitle("Object Initializer syntax example"));
                            _newDocument.Add(source);
                            break;

                        case "expectresponse":
                            // Don't add the Handlng Response section title if it was the last title (it might be defined in the doc already)
                            if (!LastSectionTitleMatches(text => text.Equals("Handling responses", StringComparison.OrdinalIgnoreCase)))
                            {
                                _newDocument.Add(CreateSubsectionTitle("Handling Responses"));
                            }
                            _newDocument.Add(source);
                            break;

                        default:
                            _newDocument.Add(source);
                            break;
                        }
                    }
                    else
                    {
                        _newDocument.Add(element);
                    }
                }
            }

            base.VisitContainer(elements);
        }