plugin writing to db