add hook for create and update