Move setData and toArray to entity-specific database API adapters.