Write priority to the db