CPS: Refactor metadata handling

Add some helper functions to simplify some repetitive code dealing with
CPS metadata. The duplication isn't bad now, but in the future we will
be handling additional properties that will benefit from these helpers.
2 files changed