finalize update_resource() function and it's tests; add merge_json
function with tests