Implement toDBObject() and fromDBObject() methods + unit tests.