I have a flat array of objects I\'d like to turn into a nested tree. I\'ve tried using both recursion and reduce but haven\'t quite got the desired effects