refactor how updates inside foreach to hable hub, local and resmap entities.