code: private void clearEntityAttributes(CmsEntity entity) {
  
          for (CmsEntityAttribute attribute : entity.getAttributes()) {
              if (attribute.isComplexValue()) {
                  for (CmsEntity child : attribute.getComplexValues()) {
                      clearEntityAttributes(child);
                      removeEntity(child.getId());
                  }
              }
              entity.removeAttributeSilent(attribute.getAttributeName());
          }
      }
docs: Removes all attributes from the given entity.<p>
  
  @param entity the entity