Preparing to extract out the core functionality to be run every so often to update Activity table.