setting up beforeUpdate function using deep-diff