Refactor session and start chat repository