Created by: efritz
Make "upgrade" code generic as it also mainly enables downgrades. Extract the shared parts for future use.
N/A.