public function setAttributes(
        SimpleXMLElement $element,
        array $attributes
    ) {
        $storage = $element->attributes();
        foreach ($attributes as $key => $value) {
            if (isset($storage->{$key})) {
                $storage->{$key} = $value;
            } else {
                $element->addAttribute($key, $value);
            }
        }
    }