public static void Load() { Load(Hotels, "Hotel"); Load(Administrators, "Admin"); Load(Guests, "Guest"); Load(Rooms, "Room"); for (int i = 0; i < Administrators.Count; i++) { int hotelId = Administrators[i].Hotel.Id; Administrators[i].Hotel = Hotels.First(x => x.Id == hotelId); } for (int i = 0; i < Rooms.Count; i++) { int hotelId = Rooms[i].Hotel.Id; Rooms[i].Hotel = Hotels.First(x => x.Id == hotelId); } }