public function execute($command, callable $next)
    {
        $this->queue[] = function () use ($command, $next) {
            return $next($command);
        };

        if ($this->isExecuting) {
            return;
        }
        $this->isExecuting = true;

        try {
            $returnValue = $this->executeQueuedJobs();
        } catch (\Exception $e) {
            $this->isExecuting = false;
            $this->queue = [];
            throw $e;
        }

        $this->isExecuting = false;
        return $returnValue;
    }