private function handleObject($object, $type=null) {
        if (is_object($object)) {
          if (!($object instanceof BaMLAttribute || $object instanceof BaMLText || $object instanceof BaMLVerb)) {
            throw new \CatapultApiException("Not a valid object in BaML schema. Must be either BaMLAttribute, BaMLVerb or BaMLVerb");
          }
          if (!isset($this->currentVerb)) {
            $this->setCurrentVerb($object);
          }
          if (!isset($this->currentText)) {
            $this->setCurrentText($object);
          }
           
          $this->addData($object);
        } else {
            /** for this initialization we need type to be set **/
          $this->addData($object); 
        }
    }