static void Main(string[] args)
        {
            DBEngine <int, DBElement <int, string> > db = new DBEngine <int, DBElement <int, string> >();
            ItemFactory <int, string> itemFactory       = new ItemFactory <int, string>();

            "Demonstrating Requirement #2".title();
            DBElement <int, string> elem = itemFactory.Create();

            elem.name      = "element";
            elem.descr     = "test element";
            elem.timeStamp = DateTime.Now.AddDays(-4);
            elem.children.AddRange(new List <int> {
                1, 2, 3
            });
            elem.payload = "elem's payload";
            WriteLine("\n Item to be inserted.. \n");
            elem.showElement();
            db.insert(1, elem);
            db.showDB();
            WriteLine("\n Inserting second element into DB :");
            DBElement <int, string> elem2 = new DBElement <int, string>();

            elem2.name      = "element2";
            elem2.descr     = "test element2";
            elem2.timeStamp = DateTime.Now;
            elem2.children.AddRange(new List <int> {
                1, 2, 3, 4
            });
            elem2.payload = "elem2's payload";
            WriteLine("\nItem to be inserted.. \n");
            elem2.showElement();
            db.insert(2, elem2);
            WriteLine("\n\n DB after insertion:");
            db.showDB();
            WriteLine("\n\n DB after insertion:");
            db.showDB();
            var dict = new Dictionary <int, DBElement <int, string> >();
            var keys = db.searchForTimeStamp(DateTime.Now.AddDays(-6), DateTime.Now.AddDays(-3));

            Console.WriteLine("\nRunning a query on database..\n");
            Console.WriteLine("\n\nThe result are the following keys:\n\n");
            foreach (var item in keys)
            {
                dynamic result = db.searchValue(item);
                Console.Write("{0}, ", item);
                dict.Add(item, result);
            }
            DBFactory <int, DBElement <int, string> > dbFactory = new DBFactory <int, DBElement <int, string> >(dict);

            "Immutable database:".title('.');
            Console.WriteLine("\n\nImmutable database is of type DBFactory, which is immutable (Found in DBFactory.cs).");
        }
        static void Main(string[] args)
        {
            "Testing Item Factory".title();
            ItemFactory <int, string> itemFactoryInstance = new ItemFactory <int, string>();
            var newElement = itemFactoryInstance.Create();

            Console.WriteLine("\nThe new element created using Item factory of {0}\n is of type {1}", itemFactoryInstance.GetType(), newElement.GetType());

            ItemFactory <string, List <string> > itemFactoryInstance1 = new ItemFactory <string, List <string> >();
            var newElement1 = itemFactoryInstance1.Create();

            Console.WriteLine("\n\nThe new element created using Item factory of\n {0} is of type {1}", itemFactoryInstance1.GetType(), newElement1.GetType());
        }
        private void test()
        {
            DBEngine <int, DBElement <int, string> > db = new DBEngine <int, DBElement <int, string> >();
            ItemFactory <int, string> itemFactory       = new ItemFactory <int, string>();
            int key = 0;

            //-----------Modify Metadata--------------------------
            "Modify metadata".title('.');
            WriteLine("\n Elements in DB :");
            db.showDB();
            key = 2;
            string name        = "Nitish";
            string description = "MS in CE";

            WriteLine("\n\n\n New Details for metadata of key {0} :", key);
            WriteLine("\n Name : {0}", name);
            WriteLine("\n Description : {0}", description);
            WriteLine();
            db.modifyMetadata(key, name, description);
            WriteLine("\n\n DB after the change :");
            db.showDB();
            WriteLine();
            "".demarcation();
            //-----------Modify Metadata--------------------------

            //-------------------Replace Value instance-----------------------
            "Replace value instance".title('.');
            WriteLine("\n\n Elements in DB :");
            DBElement <int, string> elem = itemFactory.Create();

            db.showDB();
            key = 2;
            //DBElement<int, string> elem = new DBElement<int, string>();
            elem.name      = "new element";
            elem.descr     = "new test element";
            elem.timeStamp = DateTime.Now;
            elem.children.AddRange(new List <int> {
                7, 8, 9
            });
            elem.payload = "new elem's payload";
            WriteLine("\n\n New instance for replacement for key {0}:\n", key);
            elem.showElement();
            WriteLine("\n\n Replace instance of a key :");
            db.replaceKeyInstance(key, elem);
            WriteLine("\n\n DB after the change :");
            db.showDB();
            WriteLine();
            "".demarcation();
            //-------------------Replace Value instance-----------------------
        }