public PagedCollection<User> GetFriends(int key, PagingSettings settings)
 {
     var user = GetUser(key);
     var friendsTotalCount = user.Friends.Count();
     var friends = user.Friends.Skip((settings.CurrentPage -1) * settings.EntitiesPerPage).Take(settings.EntitiesPerPage);
     settings.TotalCount = friendsTotalCount;
     return new PagedCollection<User>()
     {
         Settings = settings,
         Entities = friends            
     };
 }
        public PagedCollection<User> Search(PagingSettings settings, string search = "")
        {
            var s = search ?? "";
            s = s.ToLower();
            var users = userRepository.GetMany(u => (u.UserName.ToLower() + " " + u.UserSurname.ToLower() + " " + u.UserEmail.ToLower() + " " + u.UserBirthDate.ToString().ToLower()).Contains(s));
            settings.TotalCount = users.Count();
            users = users.Skip((settings.CurrentPage - 1)*settings.EntitiesPerPage).Take(settings.EntitiesPerPage);

            return new PagedCollection<User>()
            {
                Settings = settings,
                Entities = users
            } ;
        }