      */
     public func insert<T: Entity>() -> Result<T, Error> {
         guard let E = T.self as? Object.Type else { return Result(error: .InvalidType) }
-        return Result(value: E.init() as Any as! T)
+        let inserted = E.init()
+        self.beginWrite()
+        self.add(inserted)
+        do {
+            try self.commitWrite()
+            return Result(value: inserted as Any as! T)
+        }
+        catch {
+            return Result(error: .WriteError)
+        }
     }
     
     /**

        if let sortDescriptor = request.sortDescriptor, key = sortDescriptor.key {
            results = results.sorted(key, ascending: sortDescriptor.ascending)
        }
        return Result(value: results.toArray() as Any as! [T])
    }
    
    /**

     - returns: error (in case of any)
     */
    public func remove<T: Entity>(objects: [T]) -> Result<Void, Error> {
        self.beginWrite()
        self.delete(objects.map({$0.realm}).filter({$0 != nil}).map({$0!}))
        print("count \(objects.count)")
        do {
            try self.commitWrite()
            return Result(value: ())
        }
        catch {
            return Result(error: .WriteError)
        }
    }
}