get and save model functions