public static void EnterUpdate(Animal animal, Dictionary <int, string> updates) { using (HumaneSocietyDataContext context = new HumaneSocietyDataContext()) { Animal animalToUpdate = context.Animals.Where(r => r.ID == animal.ID).FirstOrDefault(); foreach (KeyValuePair <int, string> update in updates) { if (update.Key == 1) { var categories = context.Catagories.Where(r => r.catagory1 == update.Value).ToList(); animalToUpdate.breed = DeterminedBreedIndex(categories[0].ID); } if (update.Key == 2) { var breeds = context.Breeds.Where(r => r.breed1 == update.Value).ToList(); animalToUpdate.breed = breeds[0].ID; } if (update.Key == 3) { animalToUpdate.name = update.Value; } if (update.Key == 4) { animalToUpdate.age = int.Parse(update.Value); } if (update.Key == 5) { animalToUpdate.demeanor = update.Value; } if (update.Key == 6) { animalToUpdate.kidFriendly = UserInterface.BoolStringToBit(update.Value); } if (update.Key == 7) { animalToUpdate.petFriendly = UserInterface.BoolStringToBit(update.Value); } if (update.Key == 8) { animalToUpdate.weight = int.Parse(update.Value); } } } }