Implement duplicate checking with an index.

Index code from @bishboria's ecb5b01fc89ddfa87328421a03e6a5d7885a8dab, but with @jordanhatch's error handling when the save fails.

Mongoid and DatabaseCleaner don't set up or tear down indexes by default, and I don't think there's a clean way to do this before and after the entire test run; it's also potentially expensive to do this before and after every test, not to mention tricky to do in Mongoid without generating reams of debug output (from the `Rails::Mongoid.create_indexes` method, which takes a glob pattern for model files). I went with the less elegant solution of ensuring the need indexes were in place for the test I knew would require them.