added prepersist and preupdate