public bool CreateNewCandidate(int[] skills, CandidateModel candidate) { bool result = true; var NewCandidate = new Candidate() { FirstName = candidate.FirstName, LastName = candidate.LastName, }; work.Candidates.Add(NewCandidate); if (skills != null) { for (int i = 0; i < skills.Length; i++) { var skill = new Candidate_Skills() { CandidateId = NewCandidate.Id, SkillId = skills[i] }; work.CandidateSkills.Add(skill); } } work.Commit(); return(result); }