public static long?GetClimbersGroup(this ONLCompetition comp, int birthyear, bool genderFemale) { int age = comp.GetCompYear() - birthyear; var groupsList = (from cl in comp.ONLGroupsCompLinks where cl.ONLGroup.genderFemale == genderFemale && cl.ONLGroup.oldYear >= age && cl.ONLGroup.youngYear <= age select cl.iid).ToArray(); if (groupsList.Length < 1) { return(null); } else { return(new long?(groupsList[0])); } }