private static int nextnumber()
        {
            TrimApplication.Initialize();
            using (Database db = new Database())
            {
                int intChildCnt = 0;
                int intChildLast = 0;
                List<int> classNumb = new List<int>();
                List<Classification> cl = new List<Classification>();

                TrimMainObjectSearch obj = new TrimMainObjectSearch(db, BaseObjectTypes.Classification);

                obj.SetSearchString("parent:" + 9144);
                obj.SetSortString("numberx");
                int icnt = 1;
                if (obj.FastCount > 0)
                {
                    foreach (Classification c in obj)
                    {
                        if (icnt > 98)
                        {
                            var sdsd = icnt;
                        }
                        cl.Add(c);
                        var sdsdsd = c.LevelNumberUncompressed;
                        var kkkk = c.LevelNumberUncompressed.Remove(0, 1);
                        classNumb.Add(Convert.ToInt32(kkkk));

                        icnt++;
                    }
                    //classNumb.Sort(x=>x)
                    //cl.Max(x => x.Uri);
                    intChildCnt = classNumb.Max();
                    intChildLast = classNumb.Last();
                }
                else
                {
                    intChildCnt = 0;
                }
                Console.WriteLine(" Container count: " + obj.FastCount.ToString() + " Max number: " + (intChildCnt + 10).ToString() + " Last number: " + (intChildLast + 10).ToString());
                return intChildLast + 10;
            }
        }
 private static int FindStartingNumber(long toplevelUri, Database db)
 {
     int intChildLast = 0;
     List<int> classNumb = new List<int>();
     List<Classification> cl = new List<Classification>();
     
     TrimMainObjectSearch obj = new TrimMainObjectSearch(db, BaseObjectTypes.Classification);
     
     obj.SetSearchString("parent:" + toplevelUri);
     obj.SetSortString("uri");
     
     if (obj.FastCount > 0)
     {
         foreach (Classification c in obj)
         {
             cl.Add(c);
             var kkkk = c.LevelNumberUncompressed.Remove(0, 1);
             classNumb.Add(Convert.ToInt32(kkkk));
         }
         intChildLast= classNumb.Last();
     }
     Console.WriteLine("Calculating next folder number: "+toplevelUri.ToString()+" Container count: "+obj.FastCount.ToString()+ " Last number: "+(intChildLast+10).ToString());
     return intChildLast + 10;
 }