public function sync($jobs)
    {
        $updates = 0;

        foreach ($jobs as $job) {

            $args = $job->arguments();

            if (!isset($args[0]) || !is_scalar($args[0]) || !isset($this->tasks[$args[0]])) {
                continue;
            }

            $task = $this->tasks[$args[0]];

            $task->state = $job->state();
            $updates++;
        }

        return $updates;
    }