private void OnGUI()
        {
            GUILayout.Label("TemplateEditor");

            if (GUILayout.Button("Create Item"))
            {
                ItemEditor.Init(null, (product) => {
                    // New Item created.
                    CurrentTemplate.ItemDefinitions.Add(product);
                    UpdateTemplate();
                });
            }

            if (CurrentTemplate.ItemDefinitions != null && CurrentTemplate.ItemDefinitions.Count > 0)
            {
                if (GUILayout.Button("Create Product"))
                {
                    ProductEditor.Init(null, (product) => {
                        // New Product
                        // TODO => CHECK FOR ID CONFLICT.
                        CurrentTemplate.Products.Add(product);
                        UpdateTemplate();
                    });
                }
            }

            if (CurrentTemplate.Products != null && CurrentTemplate.Products.Count > 0)
            {
                if (GUILayout.Button("Create Bundle"))
                {
                    BundleEditor.Init(null, (bundle) => {
                        // New Bundle
                        // TODO => CHECK FOR ID CONFLICT.
                        CurrentTemplate.Bundles.Add(bundle);
                        UpdateTemplate();
                    });
                }
            }

            // List Items & Products & Bundles
            DrawItems();
            DrawProducts();
            DrawBundles();
            //
        }
        private void DrawItems()
        {
            if (CurrentTemplate.ItemDefinitions == null || CurrentTemplate.ItemDefinitions.Count == 0)
            {
                return;
            }

            GUILayout.Label("Items", EditorStyles.boldLabel);
            EditorGUILayout.BeginVertical();
            itemsScrollPos = EditorGUILayout.BeginScrollView(itemsScrollPos, GUILayout.Width(300), GUILayout.Height(100));

            // DrawItems

            /// Storage variable if one of them is gonna be removed.
            Products.Item m_itemToRemove = null;

            foreach (var @base in CurrentTemplate.ItemDefinitions)
            {
                EditorGUILayout.BeginHorizontal();

                GUILayout.Label(@base.Id);
                if (GUILayout.Button("Edit"))
                {
                    ItemEditor.Init(@base, (product) => {
                        // New Item created.
                        int target = CurrentTemplate.ItemDefinitions.FindIndex(x => x.Id.Equals(@base.Id));
                        if (target != -1)
                        {
                            CurrentTemplate.ItemDefinitions[target] = product;
                            UpdateTemplate();
                        }
                    });
                }

                if (GUILayout.Button("Delete"))
                {
                    if (EditorUtility.DisplayDialog("Beware!", "Do you want to delete this item? All products using this item will be removed also!!", "Go ahead", "Cancel"))
                    {
                        m_itemToRemove = @base;
                    }
                }

                EditorGUILayout.EndHorizontal();
            }

            if (m_itemToRemove != null)
            {
                // Find products, using this id.
                if (CurrentTemplate.Products != null)
                {
                    CurrentTemplate.Products.RemoveAll(x => x.ItemId == m_itemToRemove.Id);
                }

                // Remove the item.
                CurrentTemplate.ItemDefinitions.Remove(m_itemToRemove);

                // Update the template.
                UpdateTemplate();
            }

            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
        }