[WIP] Use a transaction internally in findOrCreate

The tests are not passing yet, so this is still WIP, but I'm throwing it up here for a preliminary review :)

The case where the user passes in a transaction was the hardest to handle. We have to use the passed transaction, so other calls on the same transaction cannot be blocked. This means that we have to handle the case where something was inserted after we did a find call. In mysql and sqlite handling the unique error is no problem, but with postgres, a transaction becomes unusable if a unique constraint error is thrown inside it. This means we have  to catch the exception and handle it ourselves. This is done by creating a temp. function which returns an empty result set.