private void detach_BuffetProjectRequirements(BuffetProjectRequirement entity)
		{
			this.SendPropertyChanging();
			entity.ProjectInformation = null;
		}
 partial void DeleteBuffetProjectRequirement(BuffetProjectRequirement instance);
 partial void UpdateBuffetProjectRequirement(BuffetProjectRequirement instance);
 partial void InsertBuffetProjectRequirement(BuffetProjectRequirement instance);
		private void detach_BuffetProjectRequirements(BuffetProjectRequirement entity)
		{
			this.SendPropertyChanging();
			entity.RequirementType = null;
		}
        public void createNewEntries(int req_type, List<string> singleInstanceReqs, List<string> singleInstanceProjs, List<string> multiInstanceReqs, List<string> multiInstanceProjs, CookDBDataContext db, int filter)
        {
            //loop through lists and move all single instances that are IN multi instances TO multi instances and delete from single.
            //do this a few times to make sure no matches slip through the cracks...
            for (int p = 0; p < 5; p++)
            {
                for (int i = 0; i < singleInstanceReqs.Count(); i++)
                {
                    if (multiInstanceReqs.Contains(singleInstanceReqs[i]))
                    {
                        //if theres a match, concat a pipe and then the accompanying project id of the project that shares the req
                        multiInstanceProjs[multiInstanceReqs.IndexOf(singleInstanceReqs[i])] += "|" + singleInstanceProjs[i];
                        //remove this req from the singles
                        singleInstanceReqs.RemoveAt(i);
                        singleInstanceProjs.RemoveAt(i);
                    }
                }
            }
         

            //create new entry for each of the single instances
            for (int i = 0; i < singleInstanceReqs.Count(); i++)
            {
                BuffetProjectRequirement newEntry = new BuffetProjectRequirement();

                newEntry.name = singleInstanceReqs[i];
                newEntry.filename = singleInstanceReqs[i];
                newEntry.project_id = filter;
                newEntry.associated_projects = db.ProjectInformations.Single(z => z.project_id.Equals(singleInstanceProjs[i])).project_number;
                newEntry.requirement_type_id = req_type;
                if (newEntry.filename != "" && newEntry.filename != null)
                {
                    db.BuffetProjectRequirements.InsertOnSubmit(newEntry);
                    db.SubmitChanges();
                }
            }
            //create new entry for each of the multi instances
            for (int i = 0; i < multiInstanceReqs.Count(); i++)
            {
                BuffetProjectRequirement newEntry = new BuffetProjectRequirement();

                var brokenUpProjects = multiInstanceProjs[i].Split('|');
                foreach (string a in brokenUpProjects)
                {
                    newEntry.associated_projects += db.ProjectInformations.Single(z => z.project_id.Equals(int.Parse(a))).project_number + ",";
                }
                newEntry.associated_projects = newEntry.associated_projects.Substring(0, newEntry.associated_projects.LastIndexOf(','));
                newEntry.project_id = filter;
                newEntry.requirement_type_id = req_type;
                newEntry.name = multiInstanceReqs[i];
                newEntry.filename = multiInstanceReqs[i];
                if (newEntry.filename != "" && newEntry.filename != null)
                {
                    db.BuffetProjectRequirements.InsertOnSubmit(newEntry);
                    db.SubmitChanges();
                }
            }
        }