Refactor to avoid reflection on update of entities' keys