public function getIdentifier($generate = true){
        if(empty($this->identifier) && $generate){
            //try generating an identifier
            $relatedItem = $this->getRelatedItem();
            if(!is_null($relatedItem)){
                $this->identifier = $this->generateIdentifier();
            }
        }
        return (string) $this->identifier;
    }