private void SearchByParams(ref IEnumerable <GroupDO> groups, GetGroupsQuery getGroupsQuery)
 {
     if (!String.IsNullOrEmpty(getGroupsQuery.Name))
     {
         groups = groups.Where(x => x.Name.ToLower().Contains(getGroupsQuery.Name.ToLower()));
     }
     if (getGroupsQuery.MemberIDs != null && getGroupsQuery.MemberIDs.Any())
     {
         groups = groups.Where(x => x.MemberIDs.Select(x => getGroupsQuery.MemberIDs.Contains(x)).Any());
     }
 }
        public async Task <IEnumerable <GroupDto> > Handle(GetGroupsQuery getGroupsQuery, CancellationToken cancellationToken)
        {
            var groups = await _groupRepository.GetGroupsAsync();

            if (groups != null && groups.Any())
            {
                SearchByParams(ref groups, getGroupsQuery);
                var list = groups.Select(x => _mapper.Map <GroupDto>(x)).ToList();
                _authorizationService.FilterResultByUserRights(_httpContextAccessor.HttpContext, ref list);
                return(list);
            }
            return(new List <GroupDto>());
        }