public static NtResult <NtToken> CreateAppContainerToken(NtToken token, Sid appcontainer_sid,
                                                          IEnumerable <Sid> capabilities, bool throw_on_error)
 {
     using (var resources = new DisposableList())
     {
         SECURITY_CAPABILITIES caps = Win32Utils.CreateSecuityCapabilities(appcontainer_sid, capabilities ?? new Sid[0], resources);
         if (!Win32NativeMethods.CreateAppContainerToken(token.GetHandle(), ref caps, out SafeKernelObjectHandle new_token))
         {
             return(Win32Utils.GetLastWin32Error().CreateResultFromDosError <NtToken>(throw_on_error));
         }
         return(NtToken.FromHandle(new_token).CreateResult());
     }
 }