/// <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>
        public static 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);
        }
        /// <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);
        }