public function setType($type)
    {
        if ($type === 'document') {
            $type = self::TYPE_DOCUMENT;
        } else if ($type === 'edge') {
            $type = self::TYPE_EDGE;
        }

        if ($this->_type !== null && $this->_type !== $type) {
            throw new ClientException('Should not update the type of an existing collection');
        }

        if ($type !== self::TYPE_DOCUMENT && $type !== self::TYPE_EDGE) {
            throw new ClientException('Invalid type used for collection');
        }

        assert(is_int($type));
        $this->_type = $type;
    }