Check for duplicate before insert

Actually check for duplicate key before inserting to database.
To be honest, this change wasn't really necessary since the field
has an unique constraint on it anyways, so the database will automatically
prevent the insert. However, this creates error messages, and I don't like
error messages. I'm not even sure if this will be faster, but whatever. This
commit also switches from using bookshelf.js for insert to using
raw SQL. I'm not even sure why I'm using bookshelf.js since trade
data isn't exactly relational.