refactor client side PUT request