move schema to entity factory