private List <Person> GetDirectParents(Person person) { var listOfParents = new List <Person>(); if (!person.Mother_Id.HasValue && !person.Father_Id.HasValue) { return(listOfParents); } if (person.Mother_Id.HasValue) { var mother = StaticCache.GetPersonById(person.Mother_Id.Value); if (mother != null) { listOfParents.Add(mother); } } if (person.Father_Id.HasValue) { var father = StaticCache.GetPersonById(person.Father_Id.Value); if (father != null) { listOfParents.Add(father); } } return(listOfParents); }