add beforeCreate method