Merge "Add helper function to insert with retry."