Extract method: remove duplicate code to get module.