[Database] Refactor functions accessing the database

parent 6fdb2550
Pipeline #68 failed with stage