private void parseZeoTime(JSONObject stats, String key, ZeoSleepStatsFacet facet) {
    JSONObject o = stats.getJSONObject(key);

    int day = o.getInt("day");
    int month = o.getInt("month");
    int year = o.getInt("year");
    int hours = o.getInt("hour");
    int minutes = o.getInt("minute");
    int seconds = o.getInt("second");

    Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
    c.set(Calendar.MILLISECOND, 0);
    c.set(year, month - 1, day, hours, minutes, seconds);
    if (key.equals("bedTime")) {
      facet.startTimeStorage = toTimeStorage(year, month, day, hours, minutes, seconds);
      facet.start = c.getTimeInMillis();
    } else {
      facet.date =
          (new StringBuilder())
              .append(year)
              .append("-")
              .append(pad(month))
              .append("-")
              .append(pad(day))
              .toString();
      facet.endTimeStorage = toTimeStorage(year, month, day, hours, minutes, seconds);
      facet.end = c.getTimeInMillis();
    }
  }
 private void extractStatsData(
     List<AbstractFacet> facets, ApiData apiData, JSONObject sleepStats) {
   ZeoSleepStatsFacet facet = new ZeoSleepStatsFacet(apiData.updateInfo.apiKey.getId());
   super.extractCommonFacetData(facet, apiData);
   facet.zq = sleepStats.getInt("zq");
   parseZeoTime(sleepStats, "bedTime", facet);
   parseZeoTime(sleepStats, "riseTime", facet);
   facet.morningFeel = sleepStats.getInt("morningFeel");
   facet.totalZ = sleepStats.getInt("totalZ");
   facet.timeInDeepPercentage = sleepStats.getInt("timeInDeepPercentage");
   facet.timeInLightPercentage = sleepStats.getInt("timeInLightPercentage");
   facet.timeInRemPercentage = sleepStats.getInt("timeInRemPercentage");
   facet.timeInWakePercentage = sleepStats.getInt("timeInWakePercentage");
   facet.awakenings = sleepStats.getInt("awakenings");
   facet.timeToZ = sleepStats.getInt("timeToZ");
   facet.sleepGraph = getSleepGraph(sleepStats);
   facets.add(facet);
 }