private function add_result_item($name, $value) {

        $results = $this->task->get_results();

        if (isset($results[$name])) {
            if (!is_array($results[$name])) {
                throw new coding_exception('Unable to append a result item into a non-array structure.');
            }
            $current = $results[$name];
            $current[] = $value;
            $this->task->add_result(array($name => $current));

        } else {
            $this->task->add_result(array($name => array($value)));
        }
    }