public function restoreMorphsByEntity(IlluminateEloquentModel $entity, $relationName)
    {
        // Validate model is soft deletable
        if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) {
            throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trait');
        }

        // Retrieve all records by entity type and entity ID
        $entities = $this->onlyTrashed()
                         ->getBuilder()
                         ->select(['id'])
                         ->where(function ($query) use ($entity, $relationName) {
                             $query->where($relationName.'_type', '=', get_class($entity))
                                  ->where($relationName.'_id', '=', (int) $entity->id);
                         })
                         ->get();

        // Restore count
        $restoreCount = 0;

        // Loop through each entity individually.
        // This is required to soft delete all found entiries.
        foreach ($entities as $e) {
            if ((bool) $e->restore()) {
                $restoreCount += 1;
            }
        }

        // Reset query builder
        $this->resetBuilder();

        return $restoreCount;
    }