added sqlite db code for events