/// <summary>
        /// List all of the people in the specified collection
        /// documentation:  https://developers.google.com/+/api/latest/people/list
        /// </summary>
        /// <param name="service"></param>
        /// <param name="_userId">Get the collection of people for the person identified. Use "me" to indicate the authenticated user.</param>
        /// <returns></returns>
        public static IList<Person> GetAllPeople(PlusService service, string _userId)
        {
            PeopleResource.ListRequest list = service.People.List(_userId, PeopleResource.ListRequest.CollectionEnum.Visible);
            list.MaxResults = 50;
            PeopleFeed peopleFeed = list.Execute();
            IList<Person> people = new List<Person>();

            //// Loop through until we arrive at an empty page
            while (peopleFeed.Items != null)
            {
                // Adding each item  to the list.
                foreach (Person item in peopleFeed.Items)
                {
                    people.Add(item);
                }

                // We will know we are on the last page when the next page token is
                // null.
                // If this is the case, break.
                if (peopleFeed.NextPageToken == null)
                {
                    break;
                }

                // Prepare the next page of results
                list.PageToken = peopleFeed.NextPageToken;

                // Execute and process the next page request
                peopleFeed = list.Execute();

            }

            return people;

        }
        /// <summary>
        /// Creates friend edges within the model for each match between this user's visible people
        /// and others who already exist in the database.
        /// </summary>
        /// <param name="user">The user object to create friend edges for.</param>
        /// <param name="ps">The Google+ API client service.</param>
        /// <returns>None.</returns>
        static public void GenerateFriends(User user, PlusService ps)
        {
            // Get the PeopleFeed for the currently authenticated user using the Google+ API.
            PeopleResource.ListRequest lr = ps.People.List("me",
                                                           PeopleResource.CollectionEnum.Visible);

            PeopleFeed       pf = lr.Fetch();
            PhotohuntContext db = new PhotohuntContext();

            do
            {
                foreach (Person p in pf.Items)
                {
                    // Check whether the friend has an account on PhotoHunt
                    bool userExists = db.Users.Any(u => u.googleUserId.Equals(p.Id));

                    if (userExists)
                    {
                        // Check whether friend edge already exists.
                        User friend     = db.Users.First(f => f.googleUserId.Equals(p.Id));
                        bool edgeExists = db.Edges.Any(e => e.photohuntUserId == user.id &&
                                                       e.friendUserId == friend.id);

                        // Only add new edges when the user exists on PhotoHunt and the edge doesn't
                        // already exist
                        if (!edgeExists && userExists && friend.id != user.id)
                        {
                            // Save the friend edges.
                            DirectedUserToEdge fromFriendEdge = new DirectedUserToEdge();
                            fromFriendEdge.friendUserId    = friend.id;
                            fromFriendEdge.photohuntUserId = user.id;
                            db.Edges.Add(fromFriendEdge);

                            DirectedUserToEdge toFriendEdge = new DirectedUserToEdge();
                            toFriendEdge.friendUserId    = user.id;
                            toFriendEdge.photohuntUserId = friend.id;
                            db.Edges.Add(toFriendEdge);
                            db.SaveChanges();
                        }
                    }
                }

                lr.PageToken = pf.NextPageToken;
                pf           = lr.Fetch();
            } while (pf.NextPageToken != null);
        }