public void Insert(Airport airport)
        {
            AirportArrival airportArrival = new AirportArrival();
            AirportDeparture airportDeparture = new AirportDeparture();
            AirportDetail airportDetail = new AirportDetail();
            AirportGroundOp airportGroundOp = new AirportGroundOp();
            AirportHazard airportHazard = new AirportHazard();
            AirportTerrain airportTerrain = new AirportTerrain();
            AirportVersion airportVersion = new AirportVersion();

            IAirportArrivalRepository airportArrivalRepository = new AirportArrivalRepository(context);
            IAirportDepartureRepository airportDepartureRepository = new AirportDepartureRepository(context);
            IAirportDetailRepository airportDetailRepository = new AirportDetailRepository(context);
            IAirportGroundOpRepository airportGroundOpRepository = new AirportGroundOpRepository(context);
            IAirportHazardRepository airportHazardRepository = new AirportHazardRepository(context);
            IAirportTerrainRepository airportTerrainRepository = new AirportTerrainRepository(context);
            IAirportVersionRepository airportVersionRepository = new AirportVersionRepository(context);

            IEnumerable<IVersionedContent> entitiesToInitialize = new List<IVersionedContent> { airportArrival, airportDeparture, airportDetail, airportGroundOp, airportHazard, airportTerrain };

            airportArrival.Text = "NIL.";
            airportDeparture.Text = "NIL.";
            airportGroundOp.Text = "NIL.";
            airportHazard.Text = "NIL.";
            airportTerrain.Text = "NIL.";

            // TODO assign correct userID

            foreach (IVersionedContent entity in entitiesToInitialize) {
                entity.CreatedByUserID = 1;
                entity.CreatedOn = DateTime.UtcNow;
                entity.ApprovedByUserID = 1;
                entity.ApprovedOn = DateTime.UtcNow;
                entity.VersionNumber = 1;
            }

            airportArrivalRepository.InsertOrUpdate(airportArrival);
            airportDepartureRepository.InsertOrUpdate(airportDeparture);
            airportDetailRepository.InsertOrUpdate(airportDetail);
            airportGroundOpRepository.InsertOrUpdate(airportGroundOp);
            airportHazardRepository.InsertOrUpdate(airportHazard);
            airportTerrainRepository.InsertOrUpdate(airportTerrain);

            airportVersion.Airport = airport;
            airportVersion.Arrival = airportArrival;
            airportVersion.Departure = airportDeparture;
            airportVersion.Detail = airportDetail;
            airportVersion.GroundOp = airportGroundOp;
            airportVersion.Hazard = airportHazard;
            airportVersion.Terrain = airportTerrain;
            airportVersion.CreatedOn = DateTime.UtcNow;

            context.Airport.Add(airport);

            airportVersionRepository.InsertOrUpdate(airportVersion);
        }
        private static Airport GetAirport(Match match)
        {
            Airport airportToUpdate = new Airport();

            string IATA = match.Value.Substring(0, 3);
            airportToUpdate.IATA = IATA;

            return airportToUpdate;
        }
 public void Update(Airport airport)
 {
     context.Airport.Attach(airport);
     context.Entry(airport).State = EntityState.Modified;
 }