protected function request(array $options, $defaults = TRUE) {
    $st = & drupal_static(md5(json_encode(array_merge($options, (array)$defaults))));
    if ($st) {
      return $st;
    }
    $status = \Drupal::config('groupex_form_cache.settings')->get('status');

    $all_options = $options;
    if ($defaults) {
      $all_options = array_merge_recursive($this->getDefaultOptions(), $options);
    }

    // Try to use cached data.
    if ($status == TRUE) {
      $manager = \Drupal::service('groupex_form_cache.manager');
      $data = $manager->getCache($all_options);
      // Empty array should be a valid cache, but FALSE no.
      if (FALSE !== $data) {
        $st = $data;
        return $data;
      }
    }

    try {
      $response = \Drupal::httpClient()->request('GET', GroupexRequestTrait::$uri, $all_options);
      $body = $response->getBody();
      $data = json_decode($body->getContents());

      if ($status == TRUE) {
        $manager->setCache($all_options, (array) $data);
      }
      $st = $data;
      return $data;
    }
    catch (\Exception $e) {
      watchdog_exception('openy_group_schedules', $e);
      return NULL;
    }
  }