private List <Result> UpdateAchievements()
        {
            IEnumerable <User> users;

            using (IAchievementManager manager = new AchievementManager())
            {
                // get users configured for auto update
                users = manager.GetAutoUpdateUsers();
            }

            List <Result> results = new List <Result>();

            using (SteamCommunityManager manager = new SteamCommunityManager())
                using (IAchievementService service = new AchievementService())
                {
                    foreach (User user in users)
                    {
                        Log("User: "******" ( " + user.FacebookUserId + ")");

                        if (String.IsNullOrEmpty(user.AccessToken))
                        {
                            Log("Empty AccessToken");

                            // if there is no access token, the user hasn't given the app offline_access
                            continue;
                        }

                        // update the user's achievements
                        int updated = service.UpdateAchievements(user.SteamUserId);

                        if (updated == 0)
                        {
                            Log("No updated achievements");

                            continue;
                        }

                        // get the user's unpublished achievements
                        IEnumerable <SimpleAchievement> achievements = service.GetNewAchievements(user.SteamUserId);

                        if (!achievements.Any())
                        {
                            Log("No unpublished achievements");

                            continue;
                        }

                        FacebookApp app          = new FacebookApp(user.AccessToken);
                        string      userFeedPath = String.Format("/{0}/feed/", user.FacebookUserId);

                        List <int> publishedAchievements = new List <int>();

                        // post the first 5 new achievements
                        foreach (SimpleAchievement achievement in achievements.Take(5))
                        {
                            string message = String.Format("{0} earned an achievement in {1}",
                                                           user.SteamUserId, achievement.Game.Name);
                            dynamic parameters = new ExpandoObject();
                            parameters.link        = achievement.Game.StatsUrl;
                            parameters.message     = message;
                            parameters.name        = achievement.Name;
                            parameters.description = achievement.Description;
                            parameters.picture     = achievement.ImageUrl;

                            Log(message);

                            Result result = new Result
                            {
                                SteamUserId = user.SteamUserId,
                                GameName    = achievement.Game.Name,
                                Description = achievement.Name
                            };

                            try
                            {
                                dynamic response = app.Api(userFeedPath, parameters, HttpMethod.Post);

                                publishedAchievements.Add(achievement.Id);
                            }
                            catch (FacebookApiException ex)
                            {
                                // log Facebook errors and continue
                                result.ExceptionMessage += Environment.NewLine + "Exception: " + ex.Message;
                                if (ex.InnerException != null)
                                {
                                    result.ExceptionMessage += Environment.NewLine + ", Inner Exception: " + ex.InnerException.Message;
                                }

                                Log(result.ExceptionMessage);
                            }

                            results.Add(result);
                        }

                        // update the published flag
                        service.PublishAchievements(user.SteamUserId, publishedAchievements);

                        Log("User achievements published");
                    }
                }

            return(results);
        }