code: public CmsEntity cloneEntity() {
  
          CmsEntity clone = new CmsEntity(getId(), getTypeName());
          for (CmsEntityAttribute attribute : getAttributes()) {
              if (attribute.isSimpleValue()) {
                  List<String> values = attribute.getSimpleValues();
                  for (String value : values) {
                      clone.addAttributeValue(attribute.getAttributeName(), value);
                  }
              } else {
                  List<CmsEntity> values = attribute.getComplexValues();
                  for (CmsEntity value : values) {
                      clone.addAttributeValue(attribute.getAttributeName(), value.cloneEntity());
                  }
              }
          }
          return clone;
      }
docs: Clones the given entity keeping all entity ids.<p>
  
  @return returns the cloned instance