Updated example to use factory function for resource entity resource loading