extract RemoveNamespaces and make RecursivelyRemoveNamespaces use it