renamed to_resource to as_resource