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

There were a number of functions in models/funcs.php (xxxExists) that included damn near identical code.  This commit fixes that.