protected IList <IChannelGroup> FilterGroups(IList <IChannelGroup> channelGroups) { UserProfile userProfile = null; IUserProfileDataManagement userProfileDataManagement = ServiceRegistration.Get <IUserProfileDataManagement>(); if (userProfileDataManagement != null) { userProfile = (userProfileDataManagement.GetProfileAsync(UserId).Result)?.Result; if (userProfile != null) { IList <IChannelGroup> filteredGroups = new List <IChannelGroup>(); foreach (IChannelGroup channelGroup in channelGroups) { IUserRestriction restriction = channelGroup as IUserRestriction; if (restriction != null && !userProfile.CheckUserAccess(restriction)) { continue; } filteredGroups.Add(channelGroup); } return(filteredGroups); } } return(channelGroups); }