Immutable AppDefinition

No API changes here, just refactored AppDefinition and its use sites to facilitate future enhancements (e.g. version history).