Remove duplicate code from persistence by passing in an extension parameter. Refs #1810.