persist app and term in db