Refactor composition and persistence for special handling of custom fields

Allow special handling of serialization/deserialization of custom fields
such as datetime. For example in MongoDB, datetime can be persisted natively as
datetime.datetime. But conversely, datetime needs to be stringify
before persisting in Couchbase.