Implemented rest api for nested array. Refactored rest api.
Refactored to fit new rest api for nested arrays.