// Actual methods

        static void InsertWithFeatures()
        {
            AccommodationProperty accProp = new AccommodationProperty {
                Name = "Aqua Hotel",
                AccommodationPropertyFeatures = new List <AccommodationPropertyFeature> {
                    new AccommodationPropertyFeature {
                        Name = "Open Pool"
                    },
                    new AccommodationPropertyFeature {
                        Name = "Closed Pool"
                    }
                }
            };

            using (var ctx = new ReservationSystemContext()) {
                ctx.AccommodationProperties.Add(accProp);
                ctx.SaveChanges();
            }
        }
        static void InsertWithExistingFeatures()
        {
            // Existing feature Ids: 1, 2
            var feature1 = new AccommodationPropertyFeature {
                Id = 5
            };
            var feature2 = new AccommodationPropertyFeature {
                Id = 6
            };

            using (var ctx = new ReservationSystemContext()) {
                var dbSet = ctx.Set <AccommodationPropertyFeature>();
                dbSet.Attach(feature1);
                dbSet.Attach(feature2);

                AccommodationProperty accProp = new AccommodationProperty {
                    Name = "Bar Hotel",
                    AccommodationPropertyFeatures = new List <AccommodationPropertyFeature> {
                        feature1, feature2
                    }
                };

                ctx.AccommodationProperties.Add(accProp);
                ctx.SaveChanges();
            }

            using (var ctx = new ReservationSystemContext()) {
                var dbSet = ctx.Set <AccommodationPropertyFeature>();
                dbSet.Attach(feature1);
                dbSet.Attach(feature2);

                AccommodationProperty accProp = new AccommodationProperty {
                    Name = "Foo Hotel",
                    AccommodationPropertyFeatures = new List <AccommodationPropertyFeature> {
                        feature1, feature2
                    }
                };

                ctx.AccommodationProperties.Add(accProp);
                ctx.SaveChanges();
            }
        }