Revamp database abstraction layer.
More abstract and simplify in database layer.