Improve management command for exporting pi-xml