Added tests for catalog and refactored code for servicecatalogs using fi...

Refactored code