@Override
 public long save(Object entity) {
   acquireReference();
   try {
     SQLiteDatabase db = mHelper.getWritableDatabase();
     mTableManager.checkOrCreateTable(db, entity);
     return SQLBuilder.buildReplaceSql(entity).execInsert(db, entity);
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     releaseReference();
   }
   return SQLStatement.NONE;
 }
 @Override
 public <T> int save(Collection<T> collection) {
   acquireReference();
   try {
     if (!Checker.isEmpty(collection)) {
       SQLiteDatabase db = mHelper.getWritableDatabase();
       Object entity = collection.iterator().next();
       mTableManager.checkOrCreateTable(db, entity);
       SQLStatement stmt = SQLBuilder.buildReplaceAllSql(entity);
       return stmt.execInsertCollection(db, collection);
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     releaseReference();
   }
   return SQLStatement.NONE;
 }