added recursive option, default to true, but add_resource, and add_resources should call serialize with recursive false to prevent infinite embedded resource.