for (UserAchievement userAchievement : userAchievements)
{
Achievement achievement = userAchievement.getAchievement();
if (achievement.isActive())
{
final Difficulty difficulty = achievement.getDifficulty();
Integer count = achievementsByLevel.get(difficulty);
if (count == null)
{
count = 0;
}