private IEnumerable <ExchangeRoleAssignment> FindExchangeRoleAssignments(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize = 2147483647, bool includeScopes = true)
        {
            IEnumerable <ExchangeRoleAssignment> roleAssignments = base.FindAndHandleException <ExchangeRoleAssignment>(filter, rootId, deepSearch, sortBy, pageSize);
            IEnumerable <string> roleNames = (from roleAssignment in roleAssignments
                                              select roleAssignment.Role.Name).Distinct(StringComparer.OrdinalIgnoreCase).ToArray <string>();
            Dictionary <string, ExchangeRole> cannedRoles = new Dictionary <string, ExchangeRole>(StringComparer.OrdinalIgnoreCase);

            foreach (string text in roleNames)
            {
                ExchangeRole exchangeRole = new ExchangeRole
                {
                    Name = text
                };
                if (this.UpdateImplictScope(exchangeRole))
                {
                    cannedRoles.Add(text, exchangeRole);
                }
            }
            foreach (ExchangeRoleAssignment roleAssignment2 in roleAssignments)
            {
                FfoDirectorySession.FixDistinguishedName(roleAssignment2, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)roleAssignment2.Identity).ObjectGuid, ExchangeRoleAssignment.RdnContainer);
                roleAssignment2.Role = FfoDirectorySession.GetUpdatedADObjectIdWithDN(roleAssignment2.Role, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ExchangeRole.RdnContainer);
                if (roleAssignment2.RoleAssigneeType == RoleAssigneeType.RoleGroup && cannedRoles.ContainsKey(roleAssignment2.Role.Name))
                {
                    ExchangeRole exchangeRole2 = cannedRoles[roleAssignment2.Role.Name];
                    roleAssignment2.RecipientReadScope  = exchangeRole2.ImplicitRecipientReadScope;
                    roleAssignment2.ConfigReadScope     = exchangeRole2.ImplicitConfigReadScope;
                    roleAssignment2.RecipientWriteScope = (RecipientWriteScopeType)exchangeRole2.ImplicitRecipientWriteScope;
                    roleAssignment2.ConfigWriteScope    = (ConfigWriteScopeType)exchangeRole2.ImplicitConfigWriteScope;
                }
                yield return(roleAssignment2);
            }
            yield break;
        }