public static void LoadAndSaveBlocks()
        {
            // Create a block to be used as sample
            Block baseBlk = new Block("BaseBlock");
            baseBlk.Record.Units = DrawingUnits.Millimeters;
            baseBlk.Entities.Add(new Line(new Vector3(-5, -5, 0), new Vector3(5, 5, 0)));
            baseBlk.Entities.Add(new Line(new Vector3(5, -5, 0), new Vector3(-5, 5, 0)));
            AttributeDefinition attdef = new AttributeDefinition("MyAttribute")
            {
                Prompt = "Enter a value:",
                Value = 0,
                Position = Vector3.Zero,
                Layer = new Layer("MyLayer")
                {
                    Color = AciColor.Red
                }
            };
            baseBlk.AttributeDefinitions.Add(attdef);

            // Blocks are saved in a similar way as other dxf, just pass the dxf file name, the DxfVersion, and optionally if the dxf needs to be saved in binary format
            // Only AutoCad2000 and newer versions are supported.
            // The block entities and attribute definitions will be added to the Model layout.
            // The drawing header units will be the ones defined in the block record.
            baseBlk.Save(baseBlk.Name + ".dxf", DxfVersion.AutoCad2000);

            DxfDocument dxf = new DxfDocument();

            // Blocks are loaded as any other dxf, just pass the dxf file name,
            // optionally you can also give it a name, by default the file name without extension will be used.
            // Only AutoCad2000 and newer versions are supported,
            // Only the entities contained in the Model layout will be used.
            // The block units will be the ones defined in the dxf header.
            Block block = Block.Load(baseBlk.Name + ".dxf", "MyBlock");

            // in case the loading process has failed check for null
            // In DEBUG mode the loading process will raise exceptions while in RELEASE it will just return null, the same as loading a DxfDocument
            if (block == null)
            {
                Console.WriteLine("Error loading the block dxf file.");
                Console.WriteLine("Press a key to continue...");
                Console.ReadKey();
                return;
            }

            // once the block is loaded we can use it in insert entities
            Insert insert = new Insert(block, new Vector2(10));

            // the block might also contain attribute definitions
            int attdefCount = block.AttributeDefinitions.Count;

            // this is the list of attribute definition tags
            // remember netDxf does not allow the use of duplicate tag names, although AutoCad allows it, it is not recommended
            ICollection<string> tags = block.AttributeDefinitions.Tags;

            // we can assign values to the insert attributes
            foreach (Attribute att in insert.Attributes)
            {
                att.Value = string.Format("{0} value", att.Tag);
            }

            // optionally we can manually add the block definition to the document
            dxf.Blocks.Add(block);

            // we add the insert entity to the document, if the block associated with the block has not been added this method will do it automatically
            dxf.AddEntity(insert);

            // also it is possible to manually add attribute definitions to a document
            AttributeDefinition def = new AttributeDefinition("AttDefOutsideBlock")
            {
                Prompt = "Enter value:",
                Value = 0,
                Color = AciColor.Blue,
                Position = new Vector3(0, 30, 0)
            };

            // we will add the attribute definition to the document just like anyother entity
            dxf.AddEntity(def);
            
            // now we can save our new document
            dxf.Save("CreateBlockFromDxf.dxf");

            DxfDocument load = DxfDocument.Load("CreateBlockFromDxf.dxf");

        }