Metaprogrammed implementation of creating Model in Resource.