private JsonValues entityToJsonValues(Entity entity) {
    Gson gson = new Gson();
    JsonValues values = new JsonValues();

    values.deck = gson.fromJson(entity.getKey().getName(), Deck.class);
    long total = 0;
    long count = 0;
    for (long rating = 1; rating <= 5; rating++) {
      long ratingCount = 0;
      String ratingKey = getRatingKey(rating);
      if (entity.hasProperty(ratingKey)) {
        ratingCount = (long) entity.getProperty(ratingKey);
      }
      count += ratingCount;
      total += ratingCount * rating;
    }
    values.rating = ((double) total) / count;

    return values;
  }