public function setSource($key, $value)
    {
        $unit = $this->searchForId($key, true);

        $source = $this->getXPathFirstItem('xliff:source', $unit);

        // If already present check
        if ($source === null) {
            $source = $unit->appendChild($this->doc->createElementNS(self::NS, 'source'));
        } elseif ($source->firstChild) {
            // If already present, we have to remove the textnode if one exists as otherwise the value will get
            // appended.
            $source->removeChild($source->firstChild);
        }

        $source->appendChild($this->doc->createTextNode($value));
    }