{
collectionId: 1,
category: 'a',
collectionType: 'typea'
}, {
collectionId: 1,
category: 'a',
collectionType: 'typea'
}, {
collectionId: 1,
category: 'b',
collectionType: 'typea'
}, {
collectionId: 2,
category: 'b',
collectionType: 'typeb'
}, {
collectionId: 2,
category: 'b',
collectionType: 'typeb'
},
What is the best approach for handling the following scenarios:
A) When there are 2 books with the same collection type and category: Both books should be grouped together and displayed as a collection in that particular category.
B) When there are 2 books with the same collection type but different categories: Both books should be grouped together and displayed as a collection on a separate shelf named "My Collection". (This shelf exists separately from other categories on the bookshelf.)
C) When there are 3 books with the same collection type but 2 of them have the same category while the 3rd has a different category: All 3 books should be grouped together and shown as a collection on a separate shelf named "My Collection". (This shelf exists separately from other categories on the bookshelf.)