Tmp method for creating nested dict from adjacency relationship of metadata