Queue writes to the db