How do I update a document when searching for ID and using generic object

I keep getting this error:
System.AggregateException: One or more errors occurred. (Command findAndModify failed: After applying the update, the (immutable) field ‘_id’ was found to have been altered to _id: BinData(3, 00000000000000000000000000000000).) —> MongoDB.Driver.MongoCommandException: Command findAndModify failed: After applying the update, the (immutable) field ‘_id’ was found to have been altered to _id: BinData(3, 00000000000000000000000000000000).

The code:

    public T UpsertRecord<T>(string table, Guid id, T record)
    {
        var collection = db.GetCollection<T>(table);

        var filter = Builders<T>.Filter.Eq("_id", id);

        Task task = collection.FindOneAndReplaceAsync<T>(filter, record, new FindOneAndReplaceOptions<T, T> { IsUpsert = true });

        task.Wait();

        return record;


    }

Below is the data im trying to post/update:

        //Update data
        const string testNameUpdate = "MrSnail";
        const int testTotalUpdate = 2;
        var testPersonUpdate = new TestObj { name = testNameUpdate, total = testTotalUpdate };
        var responseUpdate = _mongoDBFeedClient.UpsertRecord(collectionName, responsePerson.Id, testPersonUpdate);

I have tried replaceone and such.

I’m using Atlas Cloud Mongo DB and its “sharded”. I don’t know if it have anything to do with this but it might.
I don’t wanna change the id just update all the rest of the values id the document exists if it doesn´t I wanna create it.