/**
  * Get parent Category options
  *
  * @return array
  */
 protected function getParentCategoryOptions()
 {
     $items = $this->categoryCollectionFactory->create()->addOrder('Category_id', 'ASC')->setPageSize(3)->load()->getItems();
     $result = [];
     if (count($items) === 2) {
         $item = array_pop($items);
         $result = [$item->getCategoryId() => $item->getName()];
     }
     return $result;
 }
 /**
  * @return \Mageplaza\Blog\Model\ResourceModel\Category\Collection
  */
 public function getCategoryCollection()
 {
     $collection = $this->getData('category_collection');
     if ($collection === null) {
         $collection = $this->categoryCollectionFactory->create();
         $this->setData('category_collection', $collection);
     }
     return $collection;
 }
 /**
  * Get Category collection
  *
  * @return \Mageplaza\Blog\Model\ResourceModel\Category\Collection
  */
 protected function getCategoriesCollection()
 {
     return $this->collectionFactory->create();
 }
 /**
  * @return \Mageplaza\Blog\Model\ResourceModel\Category\Collection
  */
 public function getSelectedCategoriesCollection()
 {
     if (is_null($this->categoryCollection)) {
         $collection = $this->categoryCollectionFactory->create();
         $collection->join('mageplaza_blog_post_category', 'main_table.category_id=mageplaza_blog_post_category.category_id AND mageplaza_blog_post_category.post_id=' . $this->getId(), ['position']);
         $this->categoryCollection = $collection;
     }
     return $this->categoryCollection;
 }