[FIX] move code to orm.py