beforeCreate and beforeSave callbacks added for ActiveRecord