public function setId(Schema $schema, $id)
    {
        $reset_unique_field = ($schema->getUniqueFieldId() === $this->_id);

        // Reset the identifier, update the hash tables by re-adding the field.
        $schema->removeField($this->_id);
        $this->_id = $id;
        $schema->attachField($this);

        // Update the schema's unique field.
        if ($reset_unique_field) {
            $schema->setUniqueField($id);
        }

        return $this;
    }