private long Add(TiplocInsertAmend record)
        {
            var pair = CreateInsert(record);
            var row  = pair.row;

            row["Nlc"] = record.Nalco;
            row["NlcCheckCharacter"] = record.NalcoCheckCharacter;
            row["NlcDescription"]    = SetNullIfEmpty(record.NlcDescription);
            row["Stanox"]            = record.Stanox;
            row["ThreeLetterCode"]   = SetNullIfEmpty(record.ThreeLetterCode);
            return(pair.id);
        }
        private (DataRow row, long id) CreateInsert(TiplocInsertAmend record)
        {
            var databaseId = SetNewId(record.Code);
            var row        = Table.NewRow();

            row["Id"]          = databaseId;
            row["Action"]      = record.Action == RecordAction.Create ? "I" : "U";
            row["Tiploc"]      = record.Code;
            row["Description"] = record.Description;
            Table.Rows.Add(row);
            return(row, databaseId);
        }
        public long Find(string tiploc)
        {
            if (Lookup.TryGetValue(tiploc, out var id))
            {
                return(id);
            }

            Serilog.Log.Warning("Adding missing location {tiploc}", tiploc);
            var record = new TiplocInsertAmend()
            {
                Action      = RecordAction.Create,
                Code        = tiploc,
                Description = $"{tiploc} - MISSING"
            };

            id = CreateInsert(record).id;
            return(id);
        }