refactor persistence and facebook api access