protected function affectedRows($relation, $foreignKey, $foreignKeyIds)
    {
        $relationModel = $relation->getQuery()->getModel();
        $relationModel = new $relationModel();

        return $relationModel->withTrashed()->whereIn($foreignKey, $foreignKeyIds)->count();
    }