protected function asArray($data)
  {
    $array = [];
    
    foreach(get_object_vars((object)$data) as $k => $v){
      if ( is_object($v) ){
        $array[$k] = $this->asArray($v);
      }
      else {
        $array[$k] = $v;
      }
    }
    
    return $array;
  }