code: public function isUniqueValue($strField, $varNew, $intId = null)
      {
          $attribute = $this->getMetaModel()->getAttribute($strField);
          if ($attribute) {
              $matchingIds = $this
                  ->prepareFilter(
                      $this->getEmptyConfig()->setFilter(
                          array(
                              array(
                                  'operation' => '=',
                                  'property' => $attribute->getColName(),
                                  'value' => $varNew
                              )
                          )
                      )
                  )
                  ->getMatchingIds();
              return (count($matchingIds) == 0) || ($matchingIds == array($intId));
          }
  
          return false;
      }
docs: Determine if a given value is unique within the metamodel.
  
  @param string $strField The attribute name.
  
  @param mixed  $varNew   The value that shall be checked.
  
  @param int    $intId    The (optional) id of the item currently in scope - pass null for new items.
  
  @return bool True if the values is not yet contained within the table, false otherwise.