public function createJob($jobName, $data = null, $notBefore = null, $reference = null)
    {
        $data = [
            'type' => $jobName,
            'data' => $data,
            'reference' => $reference,
        ];
        if ($notBefore !== null) {
            $data['notbefore'] = new Time($notBefore);
        }
        $queue = $this->newEntity($data);
        if ($queue->errors()) {
            throw new Exception('Invalid entity data');
        }
        return $this->save($queue);
    }