Factor out check for DB/table existence into a helper function