Refactored validation class to use on attribute