Refactor the rake task into its own class