/**
  * Removes the blocks placed on the current slot from the database
  *
  * @return null|boolean
  * @throws \Exception
  */
 protected function deleteBlocks()
 {
     $blocks = $this->blockRepository->retrieveContentsBySlotName($this->slot->getSlotName());
     if (count($blocks) <= 0) {
         return null;
     }
     try {
         $result = null;
         $this->blockRepository->startTransaction();
         foreach ($blocks as $block) {
             $result = $this->blockRepository->setRepositoryObject($block)->delete();
             if (!$result) {
                 break;
             }
         }
         if ($result) {
             $this->blockRepository->commit();
         } else {
             $this->blockRepository->rollBack();
         }
         return $result;
     } catch (\Exception $e) {
         if (isset($this->blockRepository) && $this->blockRepository !== null) {
             $this->blockRepository->rollBack();
         }
         throw $e;
     }
 }
 protected function deleteChildren($prevSlotName)
 {
     $result = true;
     $blocks = $this->blocksRepository->retrieveContentsBySlotName($prevSlotName . '-%');
     foreach ($blocks as $block) {
         $block->setToDelete(1);
         if (!$block->save()) {
             break;
         }
     }
     return $result;
 }