# Change Tracking Service

Dealing with complex graphs of objects can be complicated and can get more complicated as the graph evolve or gets huge.

Let us start from the end of the story, what we want to achieve in our software solutions is something like the following sample code:

```csharp
var person = new Person();
person.FirstName = "first name value";
person.LastName = "last name value";

var address =  new Address();
address.Street = "street address value";

person.Addresses.Add( address );
```

Given the above code snippet we have basically 2 requirements:

* Know the state of the graph:
  * Is it changed?
  * Is there something that can be undone?
  * Is there something that can be redone?
* Change the state of the graph:
  * Accept all changes at once;
  * Reject all changes at once;
  * Undo a single change;
  * Redo a single change;&#x20;

But there is more, from the user perspective a single change can be reflected in more than one action, and thus change, in the code itself:

```csharp
var order = new Order();
order.Customer = ... //reference to a customer object;

// --> begin of "atomic" operation
var item = new OrderItem();
item.ItemId =  123;
item.Quantity = 2;
order.Items.Add( item );
// --> end of "atomic" operation
```

In the above sample the creation of the order item, the set of its properties and the add to the items collection, from the user perspective, are a single operation that matches the `add to cart` operation, given this assumptions an undo operation should rollback the entire change set and only the last operation, the add in this case.

Given these requirements the next step is to rely on something that allows us to transparently handle the entire change tracking process, the first step is to understand what [MementoEntity and MementoEntityCollection](/release-1/memento/change-tracking-service/memento-entities.md) are.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.radicalframework.com/release-1/memento/change-tracking-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
