Refactor validation in entity