Rock.Model.GroupServiceExtensions.HeadOfHousehold C# (CSharp) Method

HeadOfHousehold() public static method

Given an IQueryable of members (i.e. family members), returns the head of household for those members
public static HeadOfHousehold ( this members ) : Person
members this The members.
return Person
        public static Person HeadOfHousehold( this IQueryable<GroupMember> members )
        {
            return members
                .OrderBy( m => m.GroupRole.Order )
                .ThenBy( m => m.Person.Gender )
                .ThenBy( m => m.Person.BirthYear )
                .ThenBy( m => m.Person.BirthMonth )
                .ThenBy( m => m.Person.BirthDay )
                .Select( m => m.Person )
                .FirstOrDefault();
        }