protected function prepareTenantIds($tenants): array
    {
        // Convert collection to plain array
        if ($tenants instanceof BaseCollection && is_string($tenants->first())) {
            $tenants = $tenants->toArray();
        }

        // Find tenants by slug, and get their IDs
        if (is_string($tenants) || (is_array($tenants) && is_string(array_first($tenants)))) {
            $tenants = app('rinvex.tenants.tenant')->whereIn('slug', $tenants)->get()->pluck('id');
        }

        if ($tenants instanceof Model) {
            return [$tenants->getKey()];
        }

        if ($tenants instanceof Collection) {
            return $tenants->modelKeys();
        }

        if ($tenants instanceof BaseCollection) {
            return $tenants->toArray();
        }

        return (array) $tenants;
    }