public static IQueryable <Person> GetPeopleInLine(PersonService personService, Person currentPerson, RockContext rockContext, bool showAllIfStaff) { if (currentPerson == null) { return(new List <Person>().AsQueryable()); } if (showAllIfStaff && CheckIsStaff(currentPerson, rockContext)) { return(personService.Queryable()); } else { var cellGroupsIdsInLine = GetCellGroupIdsInLine(currentPerson, rockContext); var recordStatusIsActiveGuid = Rock.SystemGuid.DefinedValue.PERSON_RECORD_STATUS_ACTIVE.AsGuid(); var peopleInLine = new GroupMemberService(rockContext).Queryable() .Where(gm => cellGroupsIdsInLine.Contains(gm.GroupId) && gm.Person.RecordStatusValue.Guid == recordStatusIsActiveGuid) .Select(gm => gm.Person); return(peopleInLine.Distinct()); } }