Save session and settings to project database

This allows you to close Pat during a cloud session and reopen, picking
up where you left off, with proper state.