[OE-2746] updated to use CDbCriteria for all queries.