public async Task <Response> Confirm(string token) { var response = new Response(); DynamicParameters para = new DynamicParameters(); var sessions = await _dao1.Find("uspFindSetupByMicroservice", para); para.Add("@token", token); var tokenDetails = _dao.Find("uspGetAToken", para).Result; if (tokenDetails != null) { if (tokenDetails.Expires >= tokenDetails.Start) { var UtcNow = DateTime.UtcNow; var expires = UtcNow.AddMinutes(sessions.ExpiryMin); DynamicParameters parameters = new DynamicParameters(); parameters.Add("@token", token); parameters.Add("@expires", expires); parameters.Add("@start", UtcNow); parameters.Add("@email", tokenDetails.Email); int value = await _dao.Create("uspCreateToken", parameters); if (value > 0) { return new Response { Token = token, Email = tokenDetails.Email } } ; else { return(await Task.Run(() => Confirm(token))); } } } throw new NotImplementedException(); }