Simplify write_resource_cb()