Add support to define custom data collections as per the collection API.

Closes #243