Moving XML/JSON builder logic to a helper class.