public ExpandoTable updateTable(long tableId, String name)
      throws PortalException, SystemException {

    ExpandoTable table = expandoTablePersistence.findByPrimaryKey(tableId);

    if (table.getName().equals(ExpandoTableConstants.DEFAULT_TABLE_NAME)) {
      throw new TableNameException("Cannot rename " + ExpandoTableConstants.DEFAULT_TABLE_NAME);
    }

    validate(table.getCompanyId(), tableId, table.getClassNameId(), name);

    table.setName(name);

    return expandoTablePersistence.update(table);
  }