Reduce the code used for the getDatabase functions