Improved internal design

This commit introduces the following improvements:
(1) Instead of Collection and Instance we now have Resource and
Collection.
(2) A Resource can be a singleton resource.
(3) Endpoints are defined on Resource instead of Collection.
(4) Renames the helper methods on Resource to avoid property conflicts
with data.
(5) Subresources can also be of Resource type instead of Collection only.