implement persistence logic