Refactored validation logic in ORM