public async Task UpsertSeanceAsync(SeanceModel seanceModel) { try { using (OperationContext context = _seanceRepository.GetOperationContext()) { int id = await _seanceRepository.UpsertSeanceAsync( seanceModel.Adapt <SeanceEntity>(), context ); TypeAdapterConfig <SeatPriceModel, SeatPriceEntity> .NewConfig() .Map(dest => dest.SeanceId, sourse => id); await _seanceRepository.AddSeanceSeatPricesAsync( seanceModel .SeatPrices .Adapt <IReadOnlyCollection <SeatPriceEntity> >(), context ); TypeAdapterConfig <ServicePriceModel, ServicePriceEntity> .NewConfig() .Map(dest => dest.SeanceId, sourse => id); await _seanceRepository.AddSeanceAdditionalServicesAsync( seanceModel .Services .Adapt <IReadOnlyCollection <ServicePriceEntity> >(), context ); context.Apply(); } } catch (UniqueIndexException e) { throw new ConflictException(e); } }