public function hasRelation($name, $embedded = null)
    {
        if (!isset($this->_relations[$name])) {
            return false;
        }
        $relation = $this->_relations[$name];
        if ($embedded === null) {
            return true;
        }
        return $embedded === $relation['embedded'];
    }