Add support for conditional saving model.