> For the complete documentation index, see [llms.txt](https://darwin-framework.gitbook.io/dogs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://darwin-framework.gitbook.io/dogs/guides/4.-modifications.md).

# 4. Modifications

You can use the auto generated builder to modify serializable classes easily!

```dart
 var built = person.rebuild((builder) => builder
   ..name = "Günter"
   ..age = 25
 ); // Returns a new instance with changed name and age
```

Instead of the lamda approach, you can also create a builder instance by calling toBuilder on an object with builder capabilities and later instantiate the new object by calling build.

```dart
var builder = person.toBuilder();
builder.name = "Günter";
builder.age = 25;
var obj = builder.build(); // Returns a new instance with changed name and age 
```

{% hint style="info" %}
You have run run the code generation to generate and regenerate builders. They are not generated for bean-type models, consider mutating the fields for those classes.
{% endhint %}

Models can also be cloned and modified using the copy methods on DogEngine.

```dart
var person = Person([...]);
var cloned = dogs.copy<Person>(person); // Creates a copy of the object
var modified = dogs.copy<Person>(person, {
    "name": "Alex"
}); // Creates a modified copy of the object with the field "name" set to "Alex"
```
