public function get_contexts_from_consumer(ToolConsumer $consumer) {
        global $DB;

        $contexts = [];
        $contextrecords = $DB->get_records($this->contexttable, ['consumerid' => $consumer->getRecordId()], '', 'lticontextkey');
        foreach ($contextrecords as $record) {
            $context = Context::fromConsumer($consumer, $record->lticontextkey);
            $contexts[] = $context;
        }

        return $contexts;
    }