Refactoring DB access layer

* Breaking DB api and DB models into separate versions
* Fixing unit tests and dependent code
* Preparing DB models for the new API/engine

TODO:
* Adjust v2 DB models according to the new spec

Change-Id: I763cc3f401b8040a182733750ce05577653e1d35