code: public function buildEventData(array $data)
      {
          $start = strtotime($data['start']['date'] . ' ' . $data['start']['time']);
          $start = date('Y-m-d H:i:s', $start);
          $end = null;
  
          if (array_key_exists('end', $data)) {
              $end = strtotime($data['end']['date'] . ' ' . $data['end']['time']);
              $end = date('Y-m-d H:i:s', $end);
  
              if (strtotime($end) < strtotime($start)) {
                  throw new DateDifferenceException('Start date bigger then end date!');
              }
          }
  
          $event = [
              'title' => $data['title'],
              'description' => $data['description'],
              'start' => $start,
              'end' => $end,
              'all_day' => array_key_exists('all_day', $data),
              'border_color' => $data['border_color'],
              'background_color' => $data['background_color'],
              'text_color' => $data['text_color'],
          ];
  
          return $event;
      }
docs: Builds event data
  
  @param array $data
  
  @return array