Cleaned up duplication of code in "xxxExists" methods in models/funcs.php