public GeneratedCSharpDocument Render(CSharpSourceTree sourceTree)
            {
                Render(sourceTree.Children);

                var generatedCode           = _generationContext.Writer.GenerateCode();
                var lineMappings            = _generationContext.Writer.LineMappingManager.Mappings;
                var generatedCSharpDocument = new GeneratedCSharpDocument
                {
                    GeneratedCode = generatedCode,
                    LineMappings  = lineMappings,
                };

                return(generatedCSharpDocument);
            }
        public static void SetGeneratedCSharpDocument(this RazorCodeDocument document, GeneratedCSharpDocument code)
        {
            if (document == null)
            {
                throw new ArgumentNullException(nameof(document));
            }

            if (code == null)
            {
                throw new ArgumentNullException(nameof(code));
            }

            document.Items[typeof(GeneratedCSharpDocument)] = code;
        }