public static StringWriter RootWriter(this ControllerContext context, bool createIfNotExists = true) { var writer = createIfNotExists ? context.ActionData(true).AddOrGetExisting("UpdatePanels.Renderer", () => new StringWriter()) : context.ActionData(true).TryGetValue("UpdatePanels.Renderer", null as StringWriter) ; return(writer); }