[FEATURE][REFACTOR] Make sure Model::getAllAsJSON() can handle empty arrays