private void ReplaceObjectsOnDay(Day day) { Models.Object first = db.Objects.FirstOrDefault(o => o.ObjectName == NewDay.FirstObj); Models.Object second = db.Objects.FirstOrDefault(o => o.ObjectName == NewDay.SecondObj); Models.Object third = db.Objects.FirstOrDefault(o => o.ObjectName == NewDay.ThirdObj); Models.Object fourth = db.Objects.FirstOrDefault(o => o.ObjectName == NewDay.FourthObj); Models.Object fifth = db.Objects.FirstOrDefault(o => o.ObjectName == NewDay.FifthObj); Models.Object sixth = db.Objects.FirstOrDefault(o => o.ObjectName == NewDay.SixthObj); Models.Object seventh = db.Objects.FirstOrDefault(o => o.ObjectName == NewDay.SeventhObj); Models.Object eighth = db.Objects.FirstOrDefault(o => o.ObjectName == NewDay.EighthObj); day.AddChange(1, first); day.AddChange(2, second); day.AddChange(3, third); day.AddChange(4, fourth); day.AddChange(5, fifth); day.AddChange(6, sixth); day.AddChange(7, seventh); day.AddChange(8, eighth); }