private bool MergeAssetAllocation()
        {
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(AssetAllocationEntry.GetDefaultValue());
            CalcTotals();
            if (totalRow != 100 || totalCol != 100)
            {
                MessageBox.Show("Gesamttotal muss 100% sein.");
                return(false);
            }
            for (int col = 1; col < tableLayoutPanelAA.ColumnCount - 1; col++)
            {
                for (int row = 1; row < tableLayoutPanelAA.RowCount - 1; row++)
                {
                    FlowLayoutPanel panel = tableLayoutPanelAA.GetControlFromPosition(col, row) as FlowLayoutPanel;
                    double[]        assetAllocationRange = new double[3];

                    for (int i = 0; i < 3; i++)
                    {
                        bool parsingSuccessful = double.TryParse(panel.Controls[i].Text, out double value);
                        if (!parsingSuccessful)
                        {
                            value = 0;
                        }
                        assetAllocationRange[i] = value;
                    }

                    try
                    {
                        AssetAllocationEntry entry = panel.DataBindings[0].DataSource as AssetAllocationEntry;
                        tableUtility.MergeTableRow(entry);
                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        AssetAllocationEntry assetAllocationEntry = new AssetAllocationEntry
                        {
                            AssetClass        = tableLayoutPanelAA.GetControlFromPosition(col, 0).DataBindings[0].DataSource as AssetClass,
                            Currency          = tableLayoutPanelAA.GetControlFromPosition(0, row).DataBindings[0].DataSource as Currency,
                            StrategicMinValue = assetAllocationRange[0],
                            StrategicOptValue = assetAllocationRange[1],
                            StrategicMaxValue = assetAllocationRange[2],
                            Fund = fund
                        };
                        tableUtility.InsertTableRow(assetAllocationEntry);
                    }
                }
            }
            return(true);
        }
        private AssetAllocationEntry GetAssetAllocationEntry(AssetClass assetClass, Currency currency)
        {
            TableUtility tableUtility           = new TableUtility();
            List <AssetAllocationEntry> entries = tableUtility.ConvertRangesToObjects <AssetAllocationEntry>(tableUtility.ReadAllRows(AssetAllocationEntry.GetDefaultValue()));
            var entryQuery = from entry in entries
                             where entry.AssetClass.Name.Equals(assetClass.Name)
                             where entry.Currency.IsoCode.Equals(currency.IsoCode)
                             where entry.Fund.Index == fund.Index
                             select entry;

            List <AssetAllocationEntry> list = entryQuery.ToList();

            if (list.Count == 0)
            {
                return(null);
            }
            return(entryQuery.ToList()[0]);
        }