Add transactions for import

closes #837
- added transaction handling for import
- added transactions to model functions
- added simple tests for failing imports

Special thanks to @tgriesser for awesome debugging!