public static bool replaceKeyInstance <Key, Value>(this DBEngine <Key, DBElement <Key, Value> > dbEngine, Key key, DBElement <Key, Value> val)
 {
     if (dbEngine.containsKey(key))
     {
         dbEngine.saveToDb(key, val);
         return(true);
     }
     return(false);
 }
        public static bool addRelationship <Key, Value>(this DBEngine <Key, DBElement <Key, Value> > dbEngine, Key key, List <Key> children)
        {
            DBElement <Key, Value> elem;

            if (dbEngine.containsKey(key))
            {
                dbEngine.getValue(key, out elem);
                elem.children.AddRange(children);
                return(true);
            }
            return(false);
        }
        public static bool modifyMetadata <Key, Value>(this DBEngine <Key, DBElement <Key, Value> > dbEngine, Key key, string name, string description)
        {
            DBElement <Key, Value> elem;

            if (dbEngine.containsKey(key))
            {
                dbEngine.getValue(key, out elem);
                elem.name  = name;
                elem.descr = description;
                return(true);
            }
            return(false);
        }
        public static List <Key> searchChildren <Key, Value>(this DBEngine <Key, DBElement <Key, Value> > dbEngine, Key key)
        {
            List <Key>             children = new List <Key>();
            DBElement <Key, Value> val;

            if (dbEngine.containsKey(key))
            {
                dbEngine.getValue(key, out val);
                foreach (var child in val.children)
                {
                    children.Add(child);
                }
                return(children);
            }
            return(children);
        }
        public static bool removeRelationship <Key, Value>(this DBEngine <Key, DBElement <Key, Value> > dbEngine, Key key, List <Key> children)
        {
            DBElement <Key, Value> elem;

            if (dbEngine.containsKey(key))
            {
                dbEngine.getValue(key, out elem);
                foreach (var child in children)
                {
                    if (elem.children.Contains(child))
                    {
                        elem.children.Remove(child);
                    }
                }
                return(true);
            }
            return(false);
        }