public function unique_key_exists($value, $field = NULL)
{
if ($field === NULL) {
// Automatically determine field by looking at the value
$field = $this->unique_key($value);
}
return (bool) DB::select(array('COUNT("*")', 'total_count'))->from($this->_table_name)->where($field, '=', $value)->where($this->_primary_key, '!=', $this->pk())->execute($this->_db)->get('total_count');
}