/// <summary>
 /// Create an LSA account object.
 /// </summary>
 /// <param name="sid">The SID of the account.</param>
 /// <param name="desired_access">The desired access for the account.</param>
 /// <param name="throw_on_error">True to throw on error.</param>
 /// <returns>The created account.</returns>
 public NtResult <LsaAccount> CreateAccount(Sid sid, LsaAccountAccessRights desired_access, bool throw_on_error)
 {
     using (var buffer = sid.ToSafeBuffer())
     {
         return(SecurityNativeMethods.LsaCreateAccount(Handle, buffer,
                                                       desired_access, out SafeLsaHandle handle).CreateResult(throw_on_error,
                                                                                                              () => new LsaAccount(handle, desired_access, sid)));
     }
 }