disable other default row- Entity framework I have a table that name is Store  , In Store Table , just one row can IsDefault=true at time . when I insert new Row , I check If user selected IsDefault , I  update other row whice isDefault=true . I use this code :

public AddStatus Add(AddStoreViewModel storeViewModel)
    {
        if (Exists(storeViewModel.Name)) return AddStatus.Exists;
        var storeModel = Mapper.Map(storeViewModel, new StoreEntity.Store());
        if (storeModel.IsDefault)
        {
            var defaultStore = GetDefault();
            if (defaultStore != null)
            {
                defaultStore.IsDefault = false;
                _uow.MarkAsBaseChanged(defaultStore); // update
            }
        }
        _uow.MarkAsBaseAdded(storeModel);
        return AddStatus.Successfull;
    }


and in controller I call Above Method like belowe and Call SaveAllChanges :

 _storeService.Add(storeViewModel);
 await _uow.SaveChangesAsync();


and  MarkAsBaseChange like belowe :

  public void MarkAsBaseChanged&lt;TEntity&gt;(TEntity entity) where TEntity : BaseEntity
    {
        Entry(entity).Entity.Action = Enums.AuditAction.Update;
}


is this code ok ?
Does _uow.MarkAsBaseChanged() primarily hide EF's SaveChanges()?
If so, make a new version that can take an array of objeects.

You would want both objects saved with one command to ensure the transaction. As it ia nw, if storeModel fails you no longer have a default store.