code: public static CmsEntity createFromNativeWrapper(JavaScriptObject entityWrapper) {
  
          CmsEntity result = new CmsEntity(null, getEntityType(entityWrapper));
          String[] simpleAttr = getSimpleAttributeNames(entityWrapper);
          for (int i = 0; i < simpleAttr.length; i++) {
              String[] simpleAttrValues = getSimpleAttributeValues(entityWrapper, simpleAttr[i]);
              for (int j = 0; j < simpleAttrValues.length; j++) {
                  result.addAttributeValue(simpleAttr[i], simpleAttrValues[j]);
              }
          }
          String[] complexAttr = getComplexAttributeNames(entityWrapper);
          for (int i = 0; i < complexAttr.length; i++) {
              JavaScriptObject[] complexAttrValues = getComplexAttributeValues(entityWrapper, complexAttr[i]);
              for (int j = 0; j < complexAttrValues.length; j++) {
                  result.addAttributeValue(complexAttr[i], createFromNativeWrapper(complexAttrValues[j]));
              }
          }
          return result;
      }
docs: Method to create an entity object from a wrapped instance.<p>
  
  @param entityWrapper the wrappe entity
  
  @return the entity