protected function getCategoryIdFromMetadata(array $attr)
    {

        // load the metadata of the passed URL rewrite entity
        $metadata = $this->getMetadata($attr);

        // return the category ID from the metadata
        return (integer) $metadata[UrlRewriteObserver::CATEGORY_ID];
    }