If the $result variable is an object you don't modify the object directly.
What I would recommend is instead of hacking the "put" code, copy the code from "put", and call it "modPut" or something to that effect.
I would recommend hacking the NEW function, to say, take an array as a function argument for the list of changes.
You can do that or, if the "conversion" can be done via SQL, you can modify your SQL statement to convert the results on the database side, verses with PHP.