/// <summary>
        /// The helper for several boot type setting methods, as they
        /// essentially send the same sequence of messages.
        /// </summary>
        /// <param name="bootType">The desired boot type.</param>
        public virtual NextBoot SetNextBoot(BootType bootType, bool uefi, bool persistent, byte instance, bool requireCommit = false)
        {
            byte completionCode = 0x00;

            SsboSetInProgress req = new SsboSetInProgress(
                false, SboSetInProgress.SetInProgress);

            SetSystemBootOptionsResponse response =
                (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                    req, typeof(SetSystemBootOptionsResponse));

            completionCode = response.CompletionCode;

            SsboBootInfoAcknowledge ack = new SsboBootInfoAcknowledge(
                false,
                SboBootInfoAcknowledgeMask.EnableWriteBiosFlag,
                SboBootInfoAcknowledgeData.None);

            response = (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                ack, typeof(SetSystemBootOptionsResponse));

            if (completionCode == 0x00)
            {
                completionCode = response.CompletionCode;
            }


            BootFlags bootFlags = BootFlags.BootFlagsValid;

            if (persistent)
            {
                bootFlags = (bootFlags | BootFlags.AllSubsequentBoots);
            }

            if (uefi)
            {
                bootFlags = (bootFlags | BootFlags.EfiBootType);
            }

            SsboBootFlags flags = new SsboBootFlags(
                false, bootFlags, bootType, 0, 0, instance);

            response = (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                flags, typeof(SetSystemBootOptionsResponse));


            if (completionCode == 0x00)
            {
                completionCode = response.CompletionCode;
            }

            if (requireCommit)
            {
                req = new SsboSetInProgress(false, SboSetInProgress.CommitWrite);

                response = (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                    req, typeof(SetSystemBootOptionsResponse));

                if (completionCode == 0x00)
                {
                    completionCode = response.CompletionCode;
                }
            }

            req = new SsboSetInProgress(false, SboSetInProgress.SetComplete);

            response = (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                req, typeof(SetSystemBootOptionsResponse));

            if (completionCode == 0x00)
            {
                completionCode = response.CompletionCode;
            }

            NextBoot nextboot = new NextBoot(completionCode);

            nextboot.BootDevice = bootType;

            return(nextboot);
        }
        /// <summary>
        /// The helper for several boot type setting methods, as they
        /// essentially send the same sequence of messages.
        /// </summary>
        /// <param name="bootType">The desired boot type.</param>
        public virtual NextBoot SetNextBoot(BootType bootType, bool uefi, bool persistent, byte instance, bool requireCommit = false)
        {
            byte completionCode = 0x00;

            SsboSetInProgress req = new SsboSetInProgress(
                                    false, SboSetInProgress.SetInProgress);

            SetSystemBootOptionsResponse response =
                                        (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                                        req, typeof(SetSystemBootOptionsResponse));

            completionCode = response.CompletionCode;

            SsboBootInfoAcknowledge ack = new SsboBootInfoAcknowledge(
                                          false,
                                          SboBootInfoAcknowledgeMask.EnableWriteBiosFlag,
                                          SboBootInfoAcknowledgeData.None);

            response = (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                        ack, typeof(SetSystemBootOptionsResponse));

            if (completionCode == 0x00)
                completionCode = response.CompletionCode;

            BootFlags bootFlags = BootFlags.BootFlagsValid;

            if (persistent)
                bootFlags = (bootFlags | BootFlags.AllSubsequentBoots);

            if (uefi)
                bootFlags = (bootFlags | BootFlags.EfiBootType);

            SsboBootFlags flags = new SsboBootFlags(
                                    false, bootFlags, bootType, 0, 0, instance);

            response = (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                                    flags, typeof(SetSystemBootOptionsResponse));

            if (completionCode == 0x00)
                completionCode = response.CompletionCode;

            if (requireCommit)
            {
                req = new SsboSetInProgress(false, SboSetInProgress.CommitWrite);

                response = (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                            req, typeof(SetSystemBootOptionsResponse));

                if (completionCode == 0x00)
                    completionCode = response.CompletionCode;
            }

            req = new SsboSetInProgress(false, SboSetInProgress.SetComplete);

            response = (SetSystemBootOptionsResponse)this.IpmiSendReceive(
                         req, typeof(SetSystemBootOptionsResponse));

            if (completionCode == 0x00)
                completionCode = response.CompletionCode;

            NextBoot nextboot = new NextBoot(completionCode);
            nextboot.BootDevice = bootType;

            return nextboot;
        }