Recursively hide tree sub categories at deeper levels and update permissions for documents and categories