Move history contents filtering logic into model.

Filtering for deleted, visible, and ids with ORM should prevent loading unneeded objects into memory (a history with 1000 items and 5 visible will now only cause 5 items to be loaded instead of 1000 just to filter out 5). Simplifies history_contents API logic somewhat, allows easier 'unit' testing (included), and provides a clearer entry point for additional 'showing' additional contents types (read dataset collections).
Dataset Collctions - model layer.

Mapping, model definition, database migration, and model unit tests to support database collections.
WIP: Dataset collection infrastructure glue.
casperjs: Fix user login, registration, logout for recent masthead changes...

They are generated in javascript instead of HTML now so I don't think they are available when page loads. My fix is to wait for the User menu to appear before attempting these operations.
casperjs: Centralize logic for test user login.
casperjs: Helper method for creating API datasets.
WIP: API functional tests for dataset collections.