public static void createNewConsolidatedRequisitionList(Dictionary <string, List <ConsolidatedRequisitionListDetail> > dictionary) { UniversityStoreEntities context = new UniversityStoreEntities(); foreach (KeyValuePair <string, List <ConsolidatedRequisitionListDetail> > kvp in dictionary) { ConsolidatedRequisitionList consolidatedList = new ConsolidatedRequisitionList(); consolidatedList.DepartmentCode = kvp.Key; consolidatedList.Status = STATUS_OPEN; EntityCollection <ConsolidatedRequisitionListDetail> listDetails = new EntityCollection <ConsolidatedRequisitionListDetail>(); List <ConsolidatedRequisitionListDetail> detailsList = kvp.Value; Console.WriteLine(detailsList.Count); foreach (ConsolidatedRequisitionListDetail detail in detailsList) { Console.WriteLine(detail.ItemNumber); Console.WriteLine("asdfasdf" + detail.QuantityRequested); listDetails.Add(detail); } consolidatedList.ConsolidatedRequisitionListDetails = listDetails; context.AddToConsolidatedRequisitionLists(consolidatedList); context.SaveChanges(); } }