/**
  * Function to return singleton object
  *
  * @return object $_singleton
  * @access public
  * @static
  */
 public static function &singleton()
 {
     if (self::$_singleton === NULL) {
         self::$_singleton = new CRM_Groupprotect_Config();
     }
     return self::$_singleton;
 }
 /**
  * Method to check if group is protected with custom field
  *
  * @param int $groupId
  * @return boolean
  * @throws Exception when API errors retrieving custom group and field
  */
 private static function groupIsProtected($groupId)
 {
     $config = CRM_Groupprotect_Config::singleton();
     $query = "SELECT " . $config->getGroupProtectCustomField('column_name') . " FROM " . $config->getGroupProtectCustomGroup('table_name') . " WHERE entity_id = %1";
     return CRM_Core_DAO::singleValueQuery($query, array(1 => array($groupId, 'Integer')));
 }