Sync model and helper files from master branch
(cherry picked from commit 86175639)
This patch backports everything related to FlatpakReference class, which we need to get in sync in order to be able to cherry-pick multi-level overrides soon.
cherry picked from the following commits: 43d1ebf1 6363d6fc 27357a84 18bde3dc f7ea88c5 7b79a6d0 204dfa3c 10edd2c4 4c246ce4 a4ab810d e567bd02