/// <summary>
 /// Tries to impersonate a <see cref="WindowsIdentityWrapper"/>
 /// </summary>
 /// <param name="idWrapper"><see cref="WindowsIdentityWrapper"/> to impersonate</param>
 /// <param name="ctxWrapper"><see cref="WindowsImpersonationContextWrapper"/> resulting from the impersonation</param>
 /// <returns><c>true</c> if impersonation was successful; otherwiese <c>false</c></returns>
 private bool TryImpersonate(WindowsIdentityWrapper idWrapper, out WindowsImpersonationContextWrapper ctxWrapper)
 {
   try
   {
     ctxWrapper = idWrapper.Impersonate();
     return true;
   }
   catch (Exception e)
   {
     _debugLogger.Error("ImpersonationService: Error when trying to impersonate User '{0}' (Domain '{1}')", e, idWrapper.UserName, idWrapper.Domain);
     ctxWrapper = null;
     return false;
   }
 }
 /// <summary>
 /// Tries to impersonate a <see cref="WindowsIdentityWrapper"/>
 /// </summary>
 /// <param name="idWrapper"><see cref="WindowsIdentityWrapper"/> to impersonate</param>
 /// <param name="ctxWrapper"><see cref="WindowsImpersonationContextWrapper"/> resulting from the impersonation</param>
 /// <returns><c>true</c> if impersonation was successful; otherwiese <c>false</c></returns>
 private bool TryImpersonate(WindowsIdentityWrapper idWrapper, out WindowsImpersonationContextWrapper ctxWrapper)
 {
     try
     {
         ctxWrapper = idWrapper.Impersonate();
         return(true);
     }
     catch (Exception e)
     {
         _debugLogger.Error("ImpersonationService: Error when trying to impersonate User '{0}' (Domain '{1}')", e, idWrapper.UserName, idWrapper.Domain);
         ctxWrapper = null;
         return(false);
     }
 }