Add a serialize method to Model

This pull request adds a `serialize` method to the `Model` class, and calls the model's `serialize` method during `sync`. This way, `serialize` can be overridden when server wants something other than a JSON representation of the attributes. This allows developer to avoid having to override the `sync` method. It should be considered the inverse of the `parse` method.