private function disableCommandByActionName(CommandCollectionInterface $commands, $actionName)
    {
        foreach ($commands->getCommands() as $command) {
            $parameters = $command->getParameters()->getArrayCopy();

            $disableCommand = false;

            if (\array_key_exists('act', $parameters)
                && ($parameters['act'] === $actionName)
            ) {
                $disableCommand = true;
            }

            if (!$disableCommand && ($command->getName() === $actionName)) {
                $disableCommand = true;
            }

            if (!$disableCommand) {
                continue;
            }

            $command->setDisabled();
        }
    }