refactoring validation, code inside entity class