Break code into methods.  Refactor to match new ApplicationGroup model