Asynchronous module completed while another operation is pending
<p>I am connecting to the Quickbooks api, download the employees inforamtion and saving it to my local database.  I am using angularjs, webapi to accomplish this. I am  getting the following error when I am saving the info to database. I do see all the functions have async and await. Can some body please help me why I am getting this error. </p>

<p>Error : </p>

<blockquote>
  <p>Server Error in '/' Application.An asynchronous module or handler completed while an asynchronous operation was still pending.</p>
</blockquote>

<p>Problem is happening in the below pasted piece of code: </p>

<pre><code> var candidate = await CandidateLoginBL.AddCandidateByEmployeeAsync(new CandidateLoginBO()
                        {
                            FirstName = e.GivenName,
                            MiddleName = e.MiddleName,
                            LastName = e.FamilyName
          });
                        }
                    });
</code></pre>

<p>The full flow is as follows :</p>

<p>js :</p>

<pre><code>QuickbookModule.factory('QuickbookService', ['$http', function ($http) {

    return {
 getQuickbooksSync: function () {
            return $http({
                url: '/api/QuickbookService/syncQuickbooks',
                method: 'GET',
                params: { IdCompany: sessionStorage.CID }
            });
        }
</code></pre>

<p>API Controller : </p>

<pre><code>[HttpGet]
        [Route("syncQuickbooks")]
        public async Task&lt;IHttpActionResult&gt; syncQuickbooks(int IdCompany)
        {
          var result = await QuickbooksBL.FullQuickbooksSync(IdCompany);
          return Ok(result);
        }
</code></pre>

<p>QuickbooksBL : </p>

<pre><code>     public static async Task&lt;List&lt;IncompleteEmp&gt;&gt; FullQuickbooksSync(int IdCompany)
            {return await SyncronizeEmps(IdCompany); }

        public static async Task&lt;List&lt;IncompleteEmp&gt;&gt; SyncronizeEmps(int companyId)
            {                   
                   ......      
                    List&lt;EmployeeBO&gt; empList = new List&lt;EmployeeBO&gt;();
                    await AddToHumanEfits(companyId, inQBEmpsInfo);                       ....    
                }
                           return IncompleteEmps;
            }


         public static async Task AddToHumanEfits(int companyId, List&lt;EmployeeQbOnlineBO&gt; qbEmpsList)
            {                
                  ....
                    qbEmpsList.ForEach(async e =&gt;
                    {  

                            // Add a record into Candidate Login. 

                      var candidate = await CandidateLoginBL.AddCandidateByEmployeeAsync(new CandidateLoginBO()
                        {
                            FirstName = e.GivenName,
                            MiddleName = e.MiddleName,
                            LastName = e.FamilyName              });
                        }
                    });    
            }
</code></pre>

<p>CandidateContactBL : </p>

<pre><code> public static async Task&lt;CandidateLoginBO&gt; AddCandidateByEmployeeAsync(CandidateLoginBO model)
        {
            return await CandidateLoginDAL.AddCandidateByEmployeeAsync(model);
        }
</code></pre>

<p>CandidateContactDAL : </p>

<pre><code>public static async Task&lt;CandidateLoginBO&gt; AddCandidateByEmployeeAsync(CandidateLoginBO model)
        {
            CandidateLoginBO candidate = new CandidateLoginBO();

                candidate = await GetByUserNameAsync(new CandidateLoginBO() { Email = model.Email });                        candidate = await AddEmployeeAsync(model);                   
            return candidate;
        }
</code></pre>