internal static void Add(ContactsViewModel ContactsModel) { using (var context = CrmContextFactory.Get()) { foreach (var NewContact in ContactsModel.GetAll()) { Contact NewContactDB = new Contact { ClientId = ContactsModel.GetClientId(), PhoneNr = NewContact.PhoneNr, PhoneType = NewContact.PhoneType, }; context.Contacts.Add(NewContactDB); } context.SaveChanges(); } }