Refactored entity validation