public function setIdentifier($identifier, $collisionFree = false){

        $returnValue = false;
        if(empty($identifier) || is_null($identifier)){
            common_Logger::w('ss');
            throw new \InvalidArgumentException("Id must not be empty");
        }

        if($this->isIdentifierAvailable($identifier)){
            $returnValue = true;
        }else{
            if($collisionFree){
                $identifier = $this->generateIdentifier($identifier);
                $returnValue = true;
            }else{
                $relatedItem = $this->getRelatedItem();
                if(!is_null($relatedItem)){
                    $identifiedElements = $relatedItem->getIdentifiedElements();
                }
                common_Logger::w("Tried to set non unique identifier ".$identifier, array('TAOITEMS', 'QTI'));
                throw new \InvalidArgumentException("The identifier \"{$identifier}\" is already in use");
            }
        }

        if($returnValue){
            $this->identifier = $identifier;
        }

        return $returnValue;
    }