How to set foreign key null by updating parent entity in EF Core?

I have two entities with this structure:

public abstract class BaseEntity
{
    public BaseEntity()
    {
        //Validate();
    }

    public Guid Id { get; set; } = Guid.NewGuid();
    public DateTime CreatedAt { get; protected set; } = DateTime.Now;
    public bool IsDeleted { get; protected set; }
    public DateTime? DeletedAt { get; protected set; }
    public DateTime? ModifiedAt { get; set; }

    public void SetAsDeleted()
    {
        DeletedAt = DateTime.Now;
        IsDeleted = true;
    }

    protected abstract void Validate();
}

public class Order : BaseEntity
{
    public Person Owner { get; set; }
    public long TotalPrice { get; set; }

    protected override void Validate()
    {
    }
}

public class Person : BaseEntity
{
    protected Person()
    {
        Orders = new List<Order>();
    }

    public Person(string name, string family)
    {
        Name = name;
        Family = family;
        Orders = new List<Order>();
    }
    
    public void AddOrder(Order order)
    {
        Orders.Add(order);
    }

    public void RemoveOrder(Guid id)
    {
        var item = Orders.FirstOrDefault(x => x.Id == id);

        if (item != null)
            Orders.Remove(item);
    }
    
    protected override void Validate()
    {
    }

    public string Name { get; set; }
    public string Family { get; set; }
    //private List<Order> _orders;
    //public IReadOnlyCollection<Order> Orders => _orders.AsReadOnly();

    public List<Order> Orders { get; set; }
}

I configured the relation between these objects like this:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);
    modelBuilder.Entity<Person>()
            .HasMany(x => x.Orders)
            .WithOne(o => o.Owner)
            //.OnDelete(DeleteBehavior.SetNull)
            .HasForeignKey("OwnerId")
            .Metadata.DependentToPrincipal?.SetPropertyAccessMode(PropertyAccessMode.Field);
}

This is my repository:

public class GenericRepository<C,T> : IGenericRepository<T> where T : BaseEntity where C : DbContext 
{
    protected ILogger<GenericRepository<C, T>> Logger;
    protected readonly C DbContext;
    
    public GenericRepository(C dbContext, ILogger<GenericRepository<C,T>> logger)
    {
        DbContext = dbContext;
        Logger = logger;
    }

    protected IDbConnection DataBaseConnection => DbContext.Database.GetDbConnection();

    public virtual async Task SoftDeleteAsync(Guid id)
    {
        var item = await DbContext.Set<T>().FirstOrDefaultAsync(x => x.Id == id);
        item.SetAsDeleted();
        await DbContext.SaveChangesAsync();
    }

    public virtual async Task AddAsync(T entity)
    {
        await DbContext.Set<T>().AddAsync(entity);
        await DbContext.SaveChangesAsync();
    }

    public virtual async Task UpdateAsync(T entity)
    {
        DbContext.Attach(entity);
        DbContext.Entry(entity).State = EntityState.Modified;
        await DbContext.SaveChangesAsync();
    }

    public virtual async Task<T> GetByIdAsync(Guid id, bool asNoTracking = true)
    {
        var query = DbContext.Set<T>().AsQueryable();

        if (asNoTracking)
            query = query.AsNoTracking();
        
        return await query.FirstOrDefaultAsync(x => x.Id == id);
    }

    public virtual async Task<IEnumerable<T>> QueryAsync(Expression<Func<T, bool>> predict, bool asNoTracking = true)
    {
        var query = DbContext.Set<T>().Where(predict);
        
        if (asNoTracking)
        {
            query = query.AsNoTracking();
        }

        return await query.ToListAsync();
    }
}

I am adding an object to the database by running this code:

Person person = new Person("unknown", "person"); 

person.AddOrder(new Order
                    {
                        TotalPrice = 200
                    });
person.AddOrder(new Order
                    {
                        TotalPrice = 300
                    });
person.AddOrder(new Order
                    {
                        TotalPrice = 400
                    });

await _personRepository.AddAsync(person);

return Ok(person.Id);

It adds one row in the person table and three rows in the orders table.

Now I would like to detach the first order from the person. It means I want to set OwnerId to null (not deleting the entire row from the order table).

This is my code:

var person = await _personRepository.GetByIdAsync(id);
person.RemoveOrder(orderid);

await _personRepository.UpdateAsync(person);
return Ok(person.Id);

but the code has no effect on the database and still there are three rows related to the given person.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật