/**
  * refresh_entity_map_with
  *
  * Leaves the entry in the entity map alone, but updates it to match the provided
  * $replacing_model_obj (which we assume to be its equivalent but somehow NOT in the entity map).
  * This is useful if you have a model object you want to make authoritative over what's in the entity map currently.
  * Note: The old $replacing_model_obj should now be destroyed as it's now un-authoritative
  *
  * @param int|string    $id
  * @param EE_Base_Class $replacing_model_obj
  * @return \EE_Base_Class
  */
 public function refresh_entity_map_with($id, $replacing_model_obj)
 {
     $obj_in_map = $this->get_from_entity_map($id);
     if ($obj_in_map) {
         if ($replacing_model_obj instanceof EE_Base_Class) {
             foreach ($replacing_model_obj->model_field_array() as $field_name => $value) {
                 $obj_in_map->set($field_name, $value);
             }
             //make the model object in the entity map's cache match the $replacing_model_obj
             foreach ($this->relation_settings() as $relation_name => $relation_obj) {
                 $obj_in_map->clear_cache($relation_name, NULL, TRUE);
                 foreach ($replacing_model_obj->get_all_from_cache($relation_name) as $cache_id => $cached_obj) {
                     $obj_in_map->cache($relation_name, $cached_obj, $cache_id);
                 }
             }
         }
         return $obj_in_map;
     } else {
         $this->add_to_entity_map($replacing_model_obj);
         return $replacing_model_obj;
     }
 }