/// <summary>
        ///     Generates the partitioning layout used for the client when restoring an image.
        /// </summary>
        public ClientPartition GenerateClientSchema()
        {
            var activeCounter = _hdToGet;

            HdNumberToGet = _hdToGet;
            //Look for first active hd
            if (!_imageSchema.HardDrives[HdNumberToGet].Active)
            {
                while (activeCounter <= _imageSchema.HardDrives.Count())
                {
                    if (_imageSchema.HardDrives[activeCounter - 1].Active)
                    {
                        HdNumberToGet = activeCounter - 1;
                    }
                    activeCounter++;
                }
            }

            LbsByte  = Convert.ToInt32(_imageSchema.HardDrives[HdNumberToGet].Lbs); //logical block size in bytes
            NewHdBlk = Convert.ToInt64(_newHdSize) / LbsByte;                       //size of client hard drive in block

            //Find the Boot partition
            if (_imageSchema.HardDrives[HdNumberToGet].Boot.Length > 0)
            {
                BootPart = _imageSchema.HardDrives[HdNumberToGet].Boot.Substring(_imageSchema.HardDrives[HdNumberToGet].Boot.Length - 1, 1);
            }

            if (!PrimaryAndExtendedPartitionLayout())
            {
                return(null);
            }

            if (ExtendedPartitionHelper.HasLogical)
            {
                if (!LogicalPartitionLayout())
                {
                    return(null);
                }
            }


            if (VolumeGroupHelpers.Any())
            {
                if (!LogicalVolumeLayout())
                {
                    return(null);
                }
            }



            //Order partitions based of block start
            PrimaryAndExtendedPartitions =
                PrimaryAndExtendedPartitions.OrderBy(part => part.Start, new CustomComparer()).ToList();
            LogicalPartitions = LogicalPartitions.OrderBy(part => part.Start, new CustomComparer()).ToList();

            return(this);
        }