def update_part_with_properties(part_instance, moved_instance, name=None):
    properties_id_dict = dict()
    for prop_instance in part_instance.properties:
        if prop_instance._json_data['property_type'] == PropertyType.ATTACHMENT_VALUE:
            moved_prop = get_mapping_dictionary()[prop_instance.id]
            if prop_instance.value:
                attachment_name = prop_instance._json_data['value'].split('/')[-1]
                with temp_chdir() as target_dir:
                    full_path = os.path.join(target_dir or os.getcwd(), attachment_name)
                    prop_instance.save_as(filename=full_path)
                    moved_prop.upload(full_path)
            else:
                moved_prop.clear()
        elif prop_instance._json_data['property_type'] == PropertyType.REFERENCES_VALUE:
            if prop_instance.value:
                moved_prop_instance = get_mapping_dictionary()[prop_instance.id]
                properties_id_dict[moved_prop_instance.id] = [ref_part.id for ref_part in prop_instance.value]
        else:
            moved_prop_instance = get_mapping_dictionary()[prop_instance.id]
            properties_id_dict[moved_prop_instance.id] = prop_instance.value
    moved_instance.update(name=str(name), update_dict=properties_id_dict, bulk=True, suppress_kevents=True)
    return moved_instance