Dependencies between async tasks
<p>I call my async method several times, ones for each unit</p>

<pre><code>var tasks = otherData.Select(async unit =&gt;
  await OneUnitProcessor.ProcessOneUnitAsync(
    var1,
    authenticationResponse,
    unit,
    reservation: new Reservation()
  )
);

await Task.WhenAll(tasks);
</code></pre>

<p>This is my async method:</p>

<pre><code> public static async Task ProcessOneUnitAsync(string var1, ServiceResponse authenticationResponse, ChannelManagerJsonHolder unit,IReservation reservation, CookieCollection cookieCollection = null)
    {
 List&lt;Task&lt;HttpResponseMessage&gt;&gt; tasksDeleteReservations = reservation.DeleteReservations(allLinksToDelete, authenticationResponse, unit);


 var occupiedPricesItems = OccupationPriceGetter.GetOccupiedPeriodsWithPrices(fiksniTecaj,   authenticationResponse, unit, cookieCollection);


 tasksOccupied = allOccupationsToInsert.Select(async price =&gt; await Api.CalendarPrices.SendRequestAsync(authenticationResponse, unit, price, unavailable: true));

 await Task.WhenAll(tasksOccupied.Union(tasksDeleteReservations));
 }
</code></pre>

<p>Basically there are tasks which delete reservations(<code>tasksDeleteReservations</code>) and  tasks that insert reservations (<code>tasksOccupied</code>). This solution is not good for me because I want achieve solution that all "old" reservations are deleted before inserting new one (all <code>tasksDeleteReservations</code> tasks are finished before <code>tasksOccupied</code>)</p>

<p>One solution would be to have two awaits inside my async method, but I don't think it is good solution two have multiple awaits (control will return to the caller and I think program will exit before all other tasks (related to inserting reservations) are finished. 
Other solution would be to block on deleting before contiuning to inserting, but this is probably not async code anymore.
<strong> How to achieve asynchronicity and order of execution in situation like this?</strong></p>

<p>EDIT1: Here is the code that calls tasks which process all units;</p>

<pre><code>   private async Task ProcessAllUnits(string var1, IEnumerable&lt;ChannelManagerJsonHolder&gt; otherData, ServiceResponse authenticationResponse)
    {

        try
        {
            var tasks = otherData.Select(async unit =&gt; await OneUnitProcessor.ProcessOneUnitAsync(fiksniTecaj, authenticationResponse, unit, reservation: new Reservation()));
            await Task.WhenAll(tasks);
        }
        catch (AggregateException ex)
        {
            foreach (var innerException in ex.InnerExceptions)
            {
                new FileLogger().Log("Unit level exception:" + innerException.Message, ChannelManager.Core.Utilities.Logging.LogLevel.Error);
            }

        }

    }
</code></pre>

<p>ProcessAllUnits is called by some other method. Here is the code of that method:</p>

<pre><code>  private async Task LoginAndProcessAllUnits(string var1, UserModel     oneGroupedCMJsonHolder,IAuthentication authentication)
 {
 var task = ProcessAllUnits(fiksniTecaj, otherData, authenticationResponse);
                await task;
   }
</code></pre>

<p>This is top level method:</p>

<pre><code>public  void ProcessAllUsersAsync(List&lt;ChannelManagerJsonHolder&gt;    CMJsonHolder, string var1)
        {
 var tasks = new List&lt;Task&gt;();
              foreach (var group in groupedCMJsonHolder)
             {
                  var task = LoginAndProcessAllUnits(fiksniTecaj, group, new    Authentication());
                   tasks.Add(task);
            }
              Task.WaitAll(tasks.ToArray());
</code></pre>

<p>}</p>