Helper for setting the value of a nested object property