I am using the reduce() method to merge the objects having same id and the corresponging array of objects nested inside each object in a array. But this reduce() method is causi