C#, dapper: Rewrite this code without unnest and parameters with lists, using list of models:


		await using var connection = new NpgsqlConnection(_dbConnectionStringHandler.ConnectionString);

		var eventsCount = conversionEvents.Count;
		var parameters = new
		{
			ids = new List<string>(eventsCount),
			eventDtms = new List<DateTime>(eventsCount),
			conversionUuids = new List<string>(eventsCount),
			transactionIds = new List<string>(eventsCount),
			offerIds = new List<int>(eventsCount),
			affiliateId = new List<int>(eventsCount),
			advertiserTariffIds = new List<long?>(eventsCount),
			advertiserTariffRates = new List<decimal?>(eventsCount),
			advertiserTariffRateTypeIds = new List<int?>(eventsCount),
			amounts = new List<decimal?>(eventsCount),
			payouts = new List<decimal?>(eventsCount),
			segments = new List<string>(eventsCount),
			stepIds = new List<int?>(eventsCount),
			hashes = new List<string>(eventsCount),
			jsonDatas = new List<string>(eventsCount),
			isUniques = new List<bool>(eventsCount),
			sravniRevenues = new List<decimal?>(eventsCount),
			sravniRevenuePercents = new List<decimal?>(eventsCount),
		};

		foreach (var conversionEventModel in conversionEvents)
		{
			parameters.ids.Add(conversionEventModel.Id);
			parameters.eventDtms.Add(conversionEventModel.EventDtm);
			parameters.conversionUuids.Add(conversionEventModel.ConversionUuid);
			parameters.transactionIds.Add(conversionEventModel.TransactionId);
			parameters.offerIds.Add(conversionEventModel.OfferId);
			parameters.affiliateId.Add(conversionEventModel.AffiliateId);
			parameters.advertiserTariffIds.Add(conversionEventModel.AdvertiserTariffId);
			parameters.advertiserTariffRates.Add(conversionEventModel.AdvertiserTariffRate);
			parameters.advertiserTariffRateTypeIds.Add(conversionEventModel.AdvertiserTariffRateTypeId);
			parameters.amounts.Add(conversionEventModel.Amount);
			parameters.payouts.Add(conversionEventModel.Payout);
			parameters.segments.Add(conversionEventModel.Segment);
			parameters.stepIds.Add(conversionEventModel.StepId);
			parameters.hashes.Add(conversionEventModel.Hash);
			parameters.jsonDatas.Add(conversionEventModel.JsonData);
			parameters.isUniques.Add(conversionEventModel.IsUnique);
			parameters.sravniRevenues.Add(conversionEventModel.SravniRevenue);
			parameters.sravniRevenuePercents.Add(conversionEventModel.SravniRevenuePercent);
		}

		const string sql = @$"
			INSERT INTO public.conversion_event (
				id,
				event_dtm,
				conversion_uuid,
				transaction_id,
				segment,
				step_id,
				offer_id,
				sravni_revenue,
				sravni_revenue_percent,
				advertiser_tariff_id,
				advertiser_tariff_rate,
				advertiser_tariff_rate_type_id,
				amount,
				payout,
				affiliate_id,
				hash,
				is_unique,
				json_data)
			SELECT
				unnest(@{nameof(parameters.ids)})							as {nameof(ConversionEventModel.Id)},
				unnest(@{nameof(parameters.eventDtms)})						as {nameof(ConversionEventModel.EventDtm)},
				unnest(@{nameof(parameters.conversionUuids)})				as {nameof(ConversionEventModel.ConversionUuid)},
				unnest(@{nameof(parameters.transactionIds)})				as {nameof(ConversionEventModel.TransactionId)},
				unnest(@{nameof(parameters.segments)})						as {nameof(ConversionEventModel.Segment)},
				unnest(@{nameof(parameters.stepIds)})						as {nameof(ConversionEventModel.StepId)},
				unnest(@{nameof(parameters.offerIds)})						as {nameof(ConversionEventModel.OfferId)},
				unnest(@{nameof(parameters.sravniRevenues)})				as {nameof(ConversionEventModel.SravniRevenue)},
				unnest(@{nameof(parameters.sravniRevenuePercents)})			as {nameof(ConversionEventModel.SravniRevenuePercent)},
				unnest(@{nameof(parameters.advertiserTariffIds)})			as {nameof(ConversionEventModel.AdvertiserTariffId)},
				unnest(@{nameof(parameters.advertiserTariffRates)})			as {nameof(ConversionEventModel.AdvertiserTariffRate)},
				unnest(@{nameof(parameters.advertiserTariffRateTypeIds)})	as {nameof(ConversionEventModel.AdvertiserTariffRateTypeId)},
				unnest(@{nameof(parameters.amounts)})						as {nameof(ConversionEventModel.Amount)},
				unnest(@{nameof(parameters.payouts)})						as {nameof(ConversionEventModel.Payout)},
				unnest(@{nameof(parameters.affiliateId)})					as {nameof(ConversionEventModel.AffiliateId)},
				unnest(@{nameof(parameters.hashes)})						as {nameof(ConversionEventModel.Hash)},
				unnest(@{nameof(parameters.isUniques)})						as {nameof(ConversionEventModel.IsUnique)},
				unnest(@{nameof(parameters.jsonDatas)}::jsonb[])			as {nameof(ConversionEventModel.JsonData)}
			on conflict (id)
			do UPDATE SET
				modified = NOW() AT TIME ZONE 'UTC',
				json_data = EXCLUDED.json_data;";

		var command = new CommandDefinition(
			commandText: sql,
			parameters: parameters,
			cancellationToken: ctx);

		await connection.ExecuteAsync(command);