fix App model generation, add flexibility to loadById method