ISSUE-5201: Changing SQL queries to use queryDB().
ISSUE-5201: Creating functions to eliminate duplication in mods/_core/modules/classes/ModuleUtility.class.php