Base model class for RethinkDB.

Adopt directly from https://github.com/chasm/thinker/