minimize local database

Now the local database is only for temporary storage of IDs scanned
offline. When these IDs are added, they are deleted from the database