moved db functions to application common