updated db.js- CAPTURE APP TERMINATION / RESTART EVENTS