private function convertTaskToArray(Task $task, $addOutput = false, $outputOffset = null)
    {
        $data = [
            'id'         => $task->getId(),
            'status'     => $task->getStatus(),
            'type'       => $task->getType(),
            'created_at' => $task->getCreatedAt()->format(\DateTime::ISO8601),
            'user_data'  => $task->getUserData()
        ];

        if (true === $addOutput) {
            $data['output'] = $task->getOutput($outputOffset);
        }

        return $data;
    }