public function saveLinkedDocuments()
    {
        if (empty($this->KeyValuePairs) || !$this->isChanged('KeyValuePairs')) {
            return;
        }

        $keyValuesPair = Convert::json2array($this->KeyValuePairs);

        /** @var DMSDocument $dmsDoc */
        $dmsDoc = singleton('DMSDocument');
        $context = $dmsDoc->getDefaultSearchContext();

        $sortBy = $this->SortBy ? $this->SortBy : 'LastEdited';
        $sortByDirection = $this->SortByDirection ? $this->SortByDirection : 'DESC';
        $sortedBy = sprintf('%s %s', $sortBy, $sortByDirection);

        /** @var DataList $documents */
        $documents = $context->getResults($keyValuesPair, $sortedBy);
        $documents = $this->addEmbargoConditions($documents);
        $documents = $this->addQueryBuilderSearchResults($documents);
    }