CDAP-557 Refactor AbstractAppFabricHandler

https://builds.cask.co/browse/CDAP-DUT133-2
``null`` indicates that the ``appId`` does not exist, while an empty collection is when the ``appId`` exists but there are no programs for that particular type. 

As tested here: https://github.com/caskdata/cdap/blob/develop/cdap-app-fabric/src/test/java/co/cask/cdap/internal/app/services/http/handlers/AppFabricHttpHandlerTest.java#L570