Updated for new ORM API.