Refactor common code from install and upgrade to base class