Refactor entities and small refactor in DAO