Helper Method to transform Entity Array into Nested Array

## Helper Method to transform Entity Array into Nested Array

It is a common use case in REST controllers to perform a `foreach` in order to turn an array of `AbstractEntity` objects into a nested array, for the response body. It would be helpful to have a helper method in the `AbstractRestController` so that this code does not need to be repeated in many places.