example for beforeValidate