public void CreatePopulationFromGenotype(int genotypeId) { var genotype = u_repo.GetGenotype(genotypeId); if (genotype == null) { throw new ArgumentNullException(); } var oldFamily = u_repo.GetFamily(genotype.FamilyId); genotype.Family = null; genotype.FamilyId = -1; var newFamily = CopyFamily(oldFamily); newFamily.BaseGenotype = genotype; newFamily.BaseGenotypeId = genotype.Id; genotype.Family = newFamily; genotype.FamilyId = newFamily.Id; u_repo.DoSaveFamily(newFamily); u_repo.SaveGenotype(genotype); }