title: Execute recursive saves together or seperately?
body: <p>I have a complex graph of objects that I am saving to the database. These objects can each connect to other graphs of a similar type. I wish to save the graph of objects and all of the graphs they connect to recursively.</p>
  <p>Is it bad practice to aggregate all of the saves and execute them under one transaction? Should each graph be saved seperately?</p>
  <p>Currently I save each subgraph separately. Below is example code (.NET)</p>
  <pre class="lang-cs prettyprint-override"><code>public async Task&lt;GraphObj&gt; SaveAllGraphs(GraphObj graph)
  {
      foreach (var node in graph.nodes)
      {
          if (node.subGraph != null)
          {
              await SaveGraph(node.subGraph);
          }
      }
      return await SaveGraphInstance(graph);
  }
  </code></pre>
  <pre class="lang-cs prettyprint-override"><code>async public Task SaveGraphInstance(GraphObj graph)
  {
          var txClient = (ITransactionalGraphClient)_client;
          await txClient.ConnectAsync();
  
          using (var tx = txClient.BeginTransaction())
          {
              await _client.Cypher.Create(...).ExecuteWithoutResultsAsync();
              await _client.Cypher.Create(...).ExecuteWithoutResultsAsync();
              await tx.CommitAsync();
          }
      }   
  }
  </code></pre>