public static async Task <IActionResult> intCatWord(CloudTable tabCats, string i_WID, string i_KID, string i_word, string i_cat, bool bulk = false)
        {
            //ID anhand vollständigem Bezeichner nachlesen
            if (i_WID == "")
            {
                TableOperation query  = TableOperation.Retrieve <WordN2I>(beqDef.partWordN2I, i_word);
                TableResult    tabRes = await tabCats.ExecuteAsync(query);

                WordN2I tmpWN2I = (WordN2I)tabRes.Result;
                tmpWN2I = tmpWN2I ?? new WordN2I();
                i_WID   = tmpWN2I.WID;
            }

            if (i_KID == "")
            {
                TableOperation query  = TableOperation.Retrieve <CatN2I>(beqDef.partCatN2I, i_cat);
                TableResult    tabRes = await tabCats.ExecuteAsync(query);

                CatN2I tmpCN2I = (CatN2I)tabRes.Result;
                tmpCN2I = tmpCN2I ?? new CatN2I();
                i_KID   = tmpCN2I.KID;
            }

            if (i_WID != "" && i_KID != "")
            {
                TableOperation query  = TableOperation.Retrieve <Word2Cat>(beqDef.partWord2Cat, i_WID);
                TableResult    tabRes = await tabCats.ExecuteAsync(query);

                Word2Cat newW2C = (Word2Cat)tabRes.Result;
                newW2C = newW2C ?? new Word2Cat();
                newW2C.reload();

                if (newW2C.catList.IndexOf(i_KID) < 0)
                {
                    newW2C.setWord(i_WID);
                    newW2C.addCat(i_KID);

                    Task <TableResult> dummyReturn;
                    if (!bulk)
                    {
                        dummyReturn = tabCats.ExecuteAsync(TableOperation.InsertOrReplace(newW2C));
                    }
                    else
                    {
                        bulkTO.Add(TableOperation.InsertOrReplace(newW2C));
                    }
                }

                query  = TableOperation.Retrieve <Word2Cat>(beqDef.partCat2Words, i_KID);
                tabRes = await tabCats.ExecuteAsync(query);

                Cat2Word newC2W = (Cat2Word)tabRes.Result;
                newC2W = newC2W ?? new Cat2Word();
                newC2W.reload();

                if (newC2W.wordList.IndexOf(i_WID) < 0)
                {
                    newC2W.setCat(i_KID);
                    newC2W.addWord(i_WID);

                    if (!bulk)
                    {
                        await tabCats.ExecuteAsync(TableOperation.InsertOrReplace(newC2W));
                    }
                    else
                    {
                        bulkTO2.Add(TableOperation.InsertOrReplace(newC2W));
                    }
                }
            }
            return(new OkObjectResult(""));
        }
        public static async Task <IActionResult> intCreateCateg(CloudTable tabCats, string i_catName, string i_catDLan, string i_catDesc, bool bulk)
        {
            string newKID = "";
            //Do we know this category already?
            TableOperation query  = TableOperation.Retrieve <CatN2I>(beqDef.partCatN2I, i_catName);
            TableResult    tabRes = await tabCats.ExecuteAsync(query);

            if (tabRes.Result == null)
            {
                newKID = "";
                //Wir kennen die kategorie noch nicht, prüfen ob es eine Unterkategorie ist,
                //dann müssen wir die ID der Oberkategorie finden
                if (i_catName.Contains('_'))
                {
                    string[] subCats = i_catName.Split('_');
                    string   supCat  = string.Join('_', subCats, 0, subCats.Length - 1);

                    //Gibt es die Oberkategorie schon?
                    query  = TableOperation.Retrieve <CatN2I>(beqDef.partCatN2I, supCat);
                    tabRes = await tabCats.ExecuteAsync(query);

                    //Superkategorie vorhanden
                    if (tabRes.Result != null)
                    {
                        //Supercategory exists, increase subcategory counter and use it for new category
                        CatN2I superCat = (CatN2I)tabRes.Result;
                        superCat.subCatCount++;
                        newKID = superCat.KID + "." + superCat.subCatCount.ToString("d3");

                        //Write back supercat, no need to wait
                        TableOperation writeBack   = TableOperation.InsertOrReplace(superCat);
                        var            dummyReturn = tabCats.ExecuteAsync(writeBack);
                    }
                    else
                    {
                        //Oberkategorie existiert noch nicht -> Fehler
                    }
                }
                else
                {
                    //Keine Unterkategorie, komplett neu
                    if (!bulk)
                    {
                        newKID = "K" + getNextCatNumber(tabCats).Result.ToString("d3");
                    }
                    else
                    {
                        newKID = "K" + (++lastBulkCat).ToString("d3");
                    }
                }

                //Wir haben eine ID, Kategorie kann erstellt werden
                if (newKID != "")
                {
                    CatN2I newCatN2I = new CatN2I();
                    newCatN2I.setKID(newKID);
                    newCatN2I.setName(i_catName);

                    CatI2N newCatI2N = new CatI2N();
                    newCatI2N.setKID(newKID);
                    newCatI2N.setName(i_catName);

                    CatI2Desc newCatDesc = new CatI2Desc();
                    newCatDesc.setKID(newKID);
                    newCatDesc.setDesc(i_catDLan, i_catDesc);


                    var dummyReturn = tabCats.ExecuteAsync(TableOperation.InsertOrReplace(newCatN2I));
                    await tabCats.ExecuteAsync(TableOperation.InsertOrReplace(newCatI2N));

                    //Kategoriebeschriftungen können auch nachträglich gespeichert werden, die können wir sammeln
                    if (!bulk)
                    {
                        await tabCats.ExecuteAsync(TableOperation.InsertOrReplace(newCatDesc));
                    }
                    else
                    {
                        bulkTO.Add(TableOperation.InsertOrReplace(newCatDesc));
                    }
                }
            }
            return(new OkObjectResult(newKID));
        }