/**
  * 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')));
 }