Started porting persistence logic