private function updateLinkedSkus($type, SKU &$sku, array $linked) {
    // Reset the upsell skus to null.
    $sku->{$type}->setValue([]);
    $fieldData = [];
    foreach ($linked as $link) {
      if ($link['type'] != $type) {
        continue;
      }
      $fieldData[$link['position']] = $link['linked_sku'];
    }
    // If there is no upsell skus to link, we simply return from here.
    if (empty($fieldData)) {
      return;
    }
    // Sort them based on position.
    ksort($fieldData);
    // Update the index to sequential values so we can set in field.
    $fieldData = array_values($fieldData);
    foreach ($fieldData as $delta => $value) {
      $sku->{$type}->set($delta, $value);
    }
  }