Allow for custom config to be passed for serializing.