private IEnumerable <RequestUser> FindDbUsers(string snpPattern, UsersCategory usersCategory, int maxCount)
        {
            var users = _securityRepository.FilterUsers(_userRepository.FindUsers(snpPattern));

            switch (usersCategory)
            {
            case UsersCategory.All:
                return(users.Take(maxCount));

            case UsersCategory.ActiveUsers:
                return(users.Where(r => r.IsActive).Take(maxCount));

            case UsersCategory.BlockedUsers:
                return(users.Where(r => !r.IsActive).Take(maxCount));

            default:
                throw new ArgumentOutOfRangeException("usersCategory");
            }
        }
 public bool CanReadUserPermissions(RequestUser entity)
 {
     return(_userSecurityService.FilterUsers(new[] { entity }.AsQueryable()).Any());
 }