public static void FillBooking(Booking booking, SqlDataReader reader) { int userId = reader.GetInt32(reader.GetOrdinal("UserId")); booking.UserId = userId; booking.ReceiveMessages = reader.GetBoolean(reader.GetOrdinal("ReceiveMessages")); var fillInt = CreateFillSimpleType <int>("EventId"); IEnumerable <SimpleType <int> > eventIds = DataBases .Access <SimpleType <int> >(BaseNames.SikonDatabase, "BookedEvents") .GetSelection(fillInt, BookingsController.PrimaryKeys(userId)); booking.BookedEventsId = new HashSet <int>(); foreach (SimpleType <int> simpleType in eventIds) { booking.BookedEventsId.Add(simpleType.Variable); } }