Refactor code

Place common conroller methods in application_controller.rb rather than repeating them multiple times in different controllers.
Format API response for group data

The call to /api/group now returns data which is well formatted for easy interpretation by visualization tools.
The response consists of two key value pairs.
"template" key contains parent_keys list and child_keys list.
"data" key contains an array where each array value representing a group and contains parent_keys' values in the same order (currently only one value) and a children key with it's values being child_values array in the same order of child_keys.