/**
  * Generate urls for UrlRewrite and save it in storage
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     /** @var $cmsPage \Magento\Cms\Model\Page */
     $cmsPage = $observer->getEvent()->getObject();
     if ($cmsPage->dataHasChangedFor('identifier')) {
         $urls = $this->cmsPageUrlRewriteGenerator->generate($cmsPage);
         $this->urlPersist->replace($urls);
     }
 }
 /**
  * Generate urls for UrlRewrite and save it in storage
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     /** @var $cmsPage \Magento\Cms\Model\Page */
     $cmsPage = $observer->getEvent()->getObject();
     if ($cmsPage->dataHasChangedFor('identifier') || $cmsPage->dataHasChangedFor('store_id')) {
         $urls = $this->cmsPageUrlRewriteGenerator->generate($cmsPage);
         $this->urlPersist->deleteByData([UrlRewrite::ENTITY_ID => $cmsPage->getId(), UrlRewrite::ENTITY_TYPE => CmsPageUrlRewriteGenerator::ENTITY_TYPE]);
         $this->urlPersist->replace($urls);
     }
 }