Consolidated duplicate code in method MapController.prototype.update()