Optimization of upsert recipe.