added a resource factory to wrap entities etc