private function filterData() {
    $filtered = $this->enrichedData;
    $param = $this->parameters;

    // Filter out by time of the day.
    if (!empty($param['time_of_day'])) {
      $filtered = array_filter($filtered, function ($item) use ($param) {
        if (in_array($item->time_of_day, $param['time_of_day'])) {
          return TRUE;
        }
        return FALSE;
      });
    }

    // GroupEx Pro response have some redundant data. Filter it out.
    if ($param['filter_length'] == 'day') {
      // Filter out by the date. Cut off days before.
      $filtered = array_filter($filtered, function ($item) use ($param) {
        if ($item->timestamp >= $param['filter_timestamp']) {
          return TRUE;
        }
        return FALSE;
      });

      // Filter out by the date. Cut off days after.
      $filtered = array_filter($filtered, function ($item) use ($param) {
        if ($item->timestamp < ($param['filter_timestamp'] + 60 * 60 * 24)) {
          return TRUE;
        }
        return FALSE;
      });
    }

    $this->filteredData = $filtered;
  }