use beforeValidate method