'Insert asset metadata if asset is not present. Update asset metadata if asset is already present.'

@contract(asset_md=AssetMetadata)
def insert_or_update(self, asset_md):

    metadata_to_insert = asset_md.to_storable()
    asset_idx = self.find(asset_md.asset_id)
    if (asset_idx is None):
        self.add(metadata_to_insert)
    else:
        self[asset_idx] = metadata_to_insert
