public async Task <PagedList <User> > GetUsers(UserParams userParams)
        {
            var users = Context.Users.Include(x => x.Photos).AsQueryable();

            var minDOB = DateTime.Now.AddYears(-userParams.MaxAge - 1);
            var maxDOB = DateTime.Now.AddYears(-userParams.MinAge);

            users = users.Where(user => user.Id != userParams.Id);

            if (userParams.MinAge != 18 || userParams.MaxAge != 99)
            {
                users = users.Where(user => user.DateOfBirth <= maxDOB && user.DateOfBirth >= minDOB);
            }

            if (!string.IsNullOrEmpty(userParams.Gender))
            {
                users = users.Where(user => user.Gender == userParams.Gender);
            }

            if (userParams.Likees)
            {
                var userLikers = await GetLikesIds(userParams.Id, userParams.Likers);

                users = users.Where(u => userLikers.Contains(u.Id));
            }

            if (userParams.Likers)
            {
                var userLikees = await GetLikesIds(userParams.Id, userParams.Likers);

                users = users.Where(u => userLikees.Contains(u.Id));
            }

            if (!string.IsNullOrEmpty(userParams.SortType))
            {
                switch (userParams.SortType)
                {
                case "created":
                    users.OrderByDescending(or => or.Created);
                    break;

                default:
                    users.OrderByDescending(order => order.LastActive);
                    break;
                }
            }
            return(await PagedList <User> .CreatePaging(users, userParams.PageSize, userParams.PageNumber));
        }
        public async Task <PagedList <Message> > GetUserMessages(MessageParams messageParams)
        {
            var messages = Context.Messages.Include(x => x.Sender).Include(x => x.Recipient).AsQueryable();

            switch (messageParams.MessageType)
            {
            case "Outbox":
                messages = messages.Where(x => x.SenderId == messageParams.Id && x.SenderDeleted == false);
                break;

            case "Inbox":
                messages = messages.Where(x => x.RecipientId == messageParams.Id && x.RecipientDeleted == false);
                break;

            default:
                messages = messages.Where(x => x.RecipientId == messageParams.Id && x.IsRead == false && x.SenderDeleted == false);
                break;
            }
            messages = messages.OrderBy(x => x.MessageSent);

            return(await PagedList <Message> .CreatePaging(messages, messageParams.PageSize, messageParams.PageNumber));
        }