Extract ORM specifics

rework of PR #454

a good case <https://github.com/advancedcontrol/doorkeeper-couchbase>
Also, we should verify that with tests (and documentation could belong there instead of on more brittle comments).