code: public static function toObject(Model $model)
      {
          if (null === static::MODEL) {
              throw new LogicException('Model class is not defined.');
          }
  
          $object = new stdClass;
  
          foreach (static::$map as $local => $remote) {
              if (is_int($local)) {
                  $local = $remote;
              }
  
              $value = $model->{'get'.ucfirst($local)}();
  
              switch ($local) {
                  case 'createdAt':
                  case 'updatedAt':
                      if ($value) {
                          $object->$remote = $value->format('Y-m-d\TH:i:sP');
                      }
  
                      break;
  
                  default:
                      $object->$remote = $value;
              }
          }
  
          return $object;
      }
docs: Cast model to object
  
  @param \Ds\Component\System\Model\Model $model
  @return stdClass
  @throws \LogicException