This is also done in FormatAction.  We should probably abstract or encapsulate the code.