static CodeAction Handle(Document document, Microsoft.CodeAnalysis.Text.TextSpan span, SyntaxNode root, SyntaxNode node, ExpressionSyntax iterateOver, bool replaceNode)
        {
            return(CodeActionFactory.Create(
                       span,
                       DiagnosticSeverity.Info,
                       "Iterate via 'foreach'",
                       ct =>
            {
                ForEachStatementSyntax foreachStmt = BuildForeach(iterateOver);

                SyntaxNode newRoot;
                var ancestor = node.GetAncestor <StatementSyntax>();
                if (replaceNode)
                {
                    newRoot = root.ReplaceNode(ancestor, new[] { foreachStmt.WithTrailingTrivia(ancestor.GetTrailingTrivia()) });
                }
                else
                {
                    newRoot = root.InsertNodesAfter(ancestor, new[] { foreachStmt.WithTrailingTrivia(ancestor.GetTrailingTrivia()) });
                }
                return Task.FromResult(document.WithSyntaxRoot(newRoot));
            }
                       ));
        }