[REVIEW] Fix remove items layer in api metadata origin/develop

Removed the metadata since it had no real value and resulted in incorrect output in the API, an array named items. The (dis)assembling logic was moved to separate tree builder/flattener classes. All refactored code was tested before the refactoring was done.