move database access to submodule