/**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->setDecorated(true);
     $this->appState->setAreaCode('catalog');
     $connection = $this->attributeResource->getConnection();
     $attributeTables = $this->getAttributeTables();
     $progress = new \Symfony\Component\Console\Helper\ProgressBar($output, count($attributeTables));
     $progress->setFormat('<comment>%message%</comment> %current%/%max% [%bar%] %percent:3s%% %elapsed%');
     $this->attributeResource->beginTransaction();
     try {
         // Find and remove unused attributes
         foreach ($attributeTables as $attributeTable) {
             $progress->setMessage($attributeTable . ' ');
             $affectedIds = $this->getAffectedAttributeIds($connection, $attributeTable);
             if (count($affectedIds) > 0) {
                 $connection->delete($attributeTable, ['value_id in (?)' => $affectedIds]);
             }
             $progress->advance();
         }
         $this->attributeResource->commit();
         $output->writeln("");
         $output->writeln("<info>Unused product attributes successfully cleaned up:</info>");
         $output->writeln("<comment>  " . implode("\n  ", $attributeTables) . "</comment>");
     } catch (\Exception $exception) {
         $this->attributeResource->rollBack();
         $output->writeln("");
         $output->writeln("<error>{$exception->getMessage()}</error>");
     }
 }
 /**
  * {@inheritdoc}
  */
 public function commit()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'commit');
     if (!$pluginInfo) {
         return parent::commit();
     } else {
         return $this->___callPlugins('commit', func_get_args(), $pluginInfo);
     }
 }