private void UpdateToDatabase(IUpdateContext upd, IDatabaseAdptor db, IEnumerable <IUpdateContext> grouptocommit, IDataSelector dataselector)
 {
     if (!upd.SuccessUpdate)
     {
         var sql = upd.Update(db.DbTypeName);
         if (sql != null)
         {
             if (upd.UpdateDataNoty != null)
             {
                 upd.UpdateDataNoty.BeforeChange(upd, grouptocommit, dataselector);
             }
             upd.SuccessCommitToDatabase(db.CommitToDatabase(sql));
             if (upd.UpdateDataNoty != null)
             {
                 upd.UpdateDataNoty.OnChanged(upd, grouptocommit, dataselector);
             }
         }
     }
 }