Add management command to flatten template