public static function insertTemplate($args)
 {
     $templateModel = new FM_Models_FM_BannerTemplates();
     if ($id = $templateModel->insertRecord($args)) {
         return $id;
     }
     return false;
 }
 public static function getSortedRandomBanners($keys = array(), $limit = null)
 {
     $site = new FM_Components_SiteConfig();
     $banner = array();
     $bannerModel = new FM_Models_FM_Banner();
     if (!$site->npBannersEnabled()) {
         $banners['18'] = $bannerModel->getBusinessRandom(array('type' => 18), 4, $keys, array());
         $banners['19'] = $bannerModel->getBusinessRandom(array('type' => 19), 4, $keys, self::getIds($banners['18']));
         $banners['20'] = $bannerModel->getBusinessRandom(array('type' => 20), 4, $keys, array_merge(self::getIds($banners['18']), self::getIds($banners['19'])));
     } else {
         $banners['18'] = $bannerModel->getRandom(array('type' => 18), 4, $keys, array());
         $banners['19'] = $bannerModel->getRandom(array('type' => 19), 4, $keys, self::getIds($banners['18']));
         $banners['20'] = $bannerModel->getRandom(array('type' => 20), 4, $keys, array_merge(self::getIds($banners['18']), self::getIds($banners['19'])));
     }
     //$banners = array_merge($banners[2],array_merge($banners[0], $banners[1]));
     $bannerTemplateModel = new FM_Models_FM_BannerTemplates();
     if (count($banners)) {
         $oids = array();
         foreach ($banners as $index => $ba) {
             foreach ($ba as $record) {
                 $record['template'] = $bannerTemplateModel->getTemplateByKeys(array('id' => $record['type']));
                 $banner[] = $record;
             }
         }
     }
     return $banner;
 }