Separated persist function to allow custom persist options