# Managing Data

## Loading the Save State

Save data is stored inside of [Save States](/esave/esave-pro/scripting/save-states.md). So the first step to managing data is to load a save state. You will need a save state ID. See [Save States](/esave/esave-pro/scripting/save-states.md) for more information.

```csharp
SaveState saveState = null;
ESave.Load(mySaveStateID).OnComplete(result =>
{
    saveState = result;
});
```

This method returns a [Save Operation](/esave/esave-pro/scripting/save-operation.md) (result type: `SaveState`).

## Save Confirmation

The `ESave.Save` method finalizes all changes made to a save state. It **should not** be called after every `AddData` or `DeleteData` operation. Instead, it should only be used when the game needs to save progress to a specific save state—typically when the player manually saves through the save menu by overwriting an existing save or creating a new one.

In other words, this method should be used minimally and only when necessary. See [Save States](/esave/esave-pro/scripting/save-states.md) for more information.

```csharp
ESave.Save(saveState);
```

This method returns a [Save Operation](/esave/esave-pro/scripting/save-operation.md) (result type: `SaveState`).


---

# 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://espergames.gitbook.io/esave/esave-pro/scripting/saving-and-loading/managing-data.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.
