private function getSessionTime(array $class) {
    $times = $class['patterns'];

    // Convert to UTC timezone to save to database.
    $siteTimezone = new \DateTimeZone(drupal_get_user_timezone());
    $gmtTimezone = new \DateTimeZone('GMT');

    $startTime = new \DateTime($class['start_date'] . ' ' . $times['start_time'] . ':00', $siteTimezone);
    $startTime->setTimezone($gmtTimezone);

    $endTime = new \DateTime($class['end_date'] . ' ' . $times['end_time'] . ':00', $siteTimezone);
    $endTime->setTimezone($gmtTimezone);

    $startDate = $startTime->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT);
    $endDate = $endTime->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT);

    $days = [];
    if (isset($times['day']) && !empty($times['day'])) {
      $days[] = strtolower($times['day']);
    }

    $paragraph = Paragraph::create(['type' => 'session_time']);
    $paragraph->set('field_session_time_days', $days);
    $paragraph->set('field_session_time_date', ['value' => $startDate, 'end_value' => $endDate]);
    $paragraph->isNew();
    $paragraph->save();

    return [
      'target_id' => $paragraph->id(),
      'target_revision_id' => $paragraph->getRevisionId(),
    ];
  }