public static Guid?GetDefaultSearchCommunityId(this ICommunitiesQuery communitiesQuery, Employer employer) { // Check the current community. var community = communitiesQuery.GetCurrentCommunity(); // If there is no current community then no community to search by. if (community == null) { return(null); } // If they cannot search all members then restrict them to the current community. return(employer.CanSearchAllMembers(community) ? (Guid?)null : community.Id); }