protected function updateExistingPivotUsingCustomClass($id, array $attributes, $touch)
    {
        $updated = $this->newPivot([
            $this->foreignPivotKey => $this->parent->{$this->parentKey},
            $this->relatedPivotKey => $this->parseId($id),
        ], true)->fill($attributes)->save();

        if ($touch) {
            $this->touchIfTouching();
        }

        return (int) $updated;
    }