/// <summary>
        /// Creates a chart of account for the company. If the chart of account id already exists, an exception will
        /// be thrown.
        /// </summary>
        /// <param name="chartOfAccounts">The chart of account to upload</param>
        public void Create(ChartOfAccounts chartOfAccounts)
        {
            var json = JsonConvert.SerializeObject(chartOfAccounts);

            Create(chartOfAccounts.Id, json);
        }
        public KnownGroupDictionary(ChartOfAccounts chartOfAccounts)
        {
            ChartOfAccounts = chartOfAccounts;

            // Mandatory groups
            #region Mandatory groups

            // Basic
            Income = new KnownGroup();
            Costs = new KnownGroup();
            Assets = new KnownGroup();
            Liabilities = new KnownGroup();

            // Income children. These groups must be children to the Income group
            FinancialIncome = new KnownGroup();

            // Costs children. These groups must be children to the Costs group
            FinancialCosts = new KnownGroup();
            DeprecationsAccordingToPlan = new KnownGroup();
            ExtraordinaryIncomeAndExpenses = new KnownGroup();
            Appropriations = new KnownGroup();
            ProfitEntryAccounts = new KnownGroup();
            Taxes = new KnownGroup();

            // Assets children. These groups must be children to the Assets group
            CurrentAssets = new KnownGroup();
            FixedAssets = new KnownGroup();
            FinancialAssets = new KnownGroup();
            Inventory = new KnownGroup();

            // Liabilities children. These groups must be children to the Liabilities group
            CurrentLiabilities = new KnownGroup();
            LongTermLiabilities = new KnownGroup();
            EquityCapital = new KnownGroup();

            #endregion

            #region Optional groups

            // Income children. These groups must be children to the Income group
            NetSales = new KnownGroup(); // Income
            OtherOperatingIncome = new KnownGroup();

            // Costs children. These groups must be children to the Costs group
            PurchaseOfGoodsAndEquipment = new KnownGroup();
            CostsForEmployees = new KnownGroup();
            SalariesSocialBenefitsEtc = new KnownGroup();
            OtherCostsForEmployees = new KnownGroup();
            ImpairmentsAndWriteBack = new KnownGroup();
            CostsOfPremisesAndProperty = new KnownGroup();
            SellingExpenses = new KnownGroup();
            AdministrativeExpenses = new KnownGroup();
            OtherOperatingExpenses = new KnownGroup();
            OperatingExpenses = new KnownGroup();
            ItemsAffectingComparability = new KnownGroup();
            GoodsForResale = new KnownGroup();
            RawMaterial = new KnownGroup();

            // Assets children. These groups must be children to the Assets group
            AccountsReceivables = new KnownGroup();
            OtherCurrentReceivables = new KnownGroup();
            CurrentInvestmentsAndLiquidFunds = new KnownGroup();
            IntangibleFixedAssets = new KnownGroup();
            LandsAndBuildings = new KnownGroup();
            MachineryAndEquipment = new KnownGroup();

            // Liabilities children. These groups must be children to the Liabilities group
            UntaxedReserves = new KnownGroup();
            NonRestrictedEquityCapital = new KnownGroup();
            RestrictedEquityCapital = new KnownGroup();
            AllocationsAndProvisions = new KnownGroup();
            BankOverdraft = new KnownGroup();
            NonCurrentLiabilities = new KnownGroup();

            #endregion
        }