static TransactionType LoadFromString(string line)
        {
            List<string> parts = FileHelpers.ParseCSVLine(line);

            if(parts.Count < 4)
            {
                return null;
            }

            return new TransactionType
            {
                Id = int.Parse(parts[0]),
                Vendor = parts[1],
                Category = parts[2],
                Identifier = parts[3].Trim(),
                IdentifierMustStart = parts.Count > 4 && bool.Parse(parts[4]),
                IdentifierCaseSensitive = parts.Count <= 5 || bool.Parse(parts[5]),
            };
        }
        public static AmazonStatement ReadAmazonCSV(string filepath)
        {
            AmazonStatement ret = new AmazonStatement(filepath);

            string[] lines = File.ReadAllText(filepath).Split('\n');

            AmazonTransaction prevEntry = null;

            foreach (string line in lines)
            {
                List <string> parts = FileHelpers.ParseCSVLine(line);

                if (parts.Count < 30)
                {
                    continue;
                }

                DateTime?date = TryToScanDate(parts[0], null, null);

                if (!date.HasValue)
                {
                    continue;
                }

                string amountStr = parts[29].Substring(1);
                double.TryParse(amountStr, out double amount);

                //Build an entry for this line by itself
                AmazonTransaction subEntry = new AmazonTransaction
                {
                    Date        = date.Value,
                    Amount      = -1 * amount,
                    Description = parts[2],
                    Category    = parts[3],
                    OrderNumber = parts[1]
                };

                //Special code here so we can combine multiple transactions with the same order number into one final transaction with sub-transactions

                AmazonTransaction wrapper = null;
                if (prevEntry != null)
                {
                    //If we had an entry in progress and this entry shares the same order number, add this entry as a sub-transaction
                    if (prevEntry.Items[0].OrderNumber.Equals(subEntry.OrderNumber))
                    {
                        wrapper              = prevEntry;
                        wrapper.Amount      += subEntry.Amount;
                        wrapper.Category    += ";" + subEntry.Category;
                        wrapper.Description += ";" + subEntry.Description;
                    }
                    else
                    {
                        //Commit the previous entry, the new entry starts a new order
                        ret.Transactions.Add(prevEntry);
                        prevEntry = null;
                    }
                }

                if (prevEntry == null)
                {
                    //Create a new wrapper to hold the sub-transactions
                    wrapper = new AmazonTransaction
                    {
                        Date        = date.Value,
                        Amount      = -1 * amount,
                        Description = parts[2],
                        Category    = parts[3],
                        OrderNumber = parts[1],
                    };
                }

                wrapper.Items.Add(subEntry);
                prevEntry = wrapper;
            }

            if (prevEntry != null)
            {
                ret.Transactions.Add(prevEntry);
            }

            return(ret);
        }