Nil return value on belongs_to association should be handled gracefully

There was an issue in `SObject.write_value` where a nil value for a belongs to association would cause an error: undefined method 'id' for Array. This change set fixes that bug and cleans up the case statement in `write_value`
I'm not wild about all this. Do you guys have any ideas? Is all this too much, and the case statement I removed is just good enough? I feel like this makes it easier to extend than does the case statement, but IDK. WDYT?