public function valueExists($field, $value = null)
    {
        $record = new static($this->table, $this->keys, $this->mapper);

        if ($value === null) {
            $value = $this->$field;
        }

        try {
            $record->load([$field => $value]);
        } catch (NoResultException $e) {
            return false;
        }

        if ($record->$field != $value) {
            return false;
        }

        // check record keys same as self
        $same = [];

        foreach ($this->keys as $key) {
            $same[] = ($record->$key == $this->$key);
        }

        // Key not same, means same value exists in other record.
        if (in_array(false, $same, true)) {
            return true;
        }

        return false;
    }