Extract module update code into a function
Test Plan: Completely untested
Reviewers: aacid, ltoscano
Reviewed By: aacid
Differential Revision: https://phabricator.kde.org/D24510