isolate the update goods logic