         }
         
         
-        // The inserted values, and the primary key
-        
-        var insertedDic = databaseDictionary
-        let primaryKey = self.dynamicType.databasePrimaryKey
-        
-        
-        // Should we include the primary key in the insert statement?
-        // We do, unless the key is a SQLite RowID, without any value.
-        
-        let rowIDColumn: String?
-        switch primaryKey {
-        case .RowID(let column):
-            if let _ = insertedDic[column]! {
-                rowIDColumn = nil
-            } else {
-                insertedDic.removeValueForKey(column)
-                rowIDColumn = column
-            }
-        default:
-            rowIDColumn = nil
-        }
-        
-        
-        // If there is nothing to insert, and primary key is not managed,
-        // something is wrong.
-        
-        guard insertedDic.count > 0 || rowIDColumn != nil else {
-            fatalError("Nothing to insert")
-        }
-        
-        
-        // INSERT INTO table ([id, ]name) VALUES ([:id, ]:name)
-        
-        let columns = insertedDic.keys
-        let columnSQL = ",".join(columns.map { $0.sqliteQuotedIdentifier })
-        let valuesSQL = ",".join([String](count: columns.count, repeatedValue: "?"))
+        // The inserted values
+        
+        let version = Version(self)
+        let insertedDic = version.databaseDictionary
+        
+        
+        // INSERT INTO table (id, name) VALUES (:id, :name)
+        
+        let columnNames = insertedDic.keys
+        let columnSQL = ",".join(columnNames.map { $0.sqliteQuotedIdentifier })
+        let valuesSQL = ",".join([String](count: columnNames.count, repeatedValue: "?"))
         let verb: String
         if let conflictResolution = conflictResolution {
             switch conflictResolution {

        let changes = try db.execute(sql, bindings: Bindings(insertedDic.values))
        
        
        // Update RowID column
        
        if let rowIDColumn = rowIDColumn, let rowID = changes.insertedRowID {
            let row = Row(sqliteDictionary: [rowIDColumn: SQLiteValue.Integer(rowID)])
            updateFromDatabaseRow(row)
        }
    }
    
    /// Throws an error if the model has no table name, or no primary key.

        }
        
        
        // Extract strong primary key
        
        let version = Version(self)
        guard let primaryKeyDictionary = version.strongPrimaryKeyDictionary else {
            fatalError("No primaryKey")
        }
        
