private List<Domain.Model.Account> QueryAccounts(TwitterContext twitterctx, List<string> Ids) { List<Domain.Model.Account> response = new List<Domain.Model.Account>(); foreach (var batch in Ids.Batch(100)) { var lookupQuery = string.Join(",", batch); var relationships = (from friendship in twitterctx.Friendship where friendship.Type == FriendshipType.Lookup && friendship.UserID == lookupQuery select friendship).SingleOrDefault().Relationships; var users = (from user in twitterctx.User where user.Type == UserType.Lookup && user.UserID == lookupQuery select user).ToList(); var joinedUserData = (from user in users join rel in relationships on user.Identifier.ID equals rel.ID select new Domain.Model.Account() { AccountId = ulong.Parse(user.Identifier.ID), AccountName = user.Identifier.ScreenName, AccountDescription = user.Description, IsFollower = rel.Connections.Contains("followed_by"), IFollow = rel.Connections.Contains("following"), ProfileImage = new Uri(user.ProfileImageUrl ?? "http://127.0.0.1") }).ToList(); response.AddRange(joinedUserData); } return response; }