added save_and_retry_on_unique to gracefully rescue unique constraint violations