Add serialization (to and from ruby primitives).

  * Model#to_primitive and Model.from_primitive.