Functionality to save and load model.