public void Add(WorkUnit workUnit)
        {
            WorkUnit AddValue(Tuple <string, object> key) => workUnit;
            WorkUnit UpdateValue(Tuple <string, object> key, WorkUnit previousWorkUnit) => previousWorkUnit.Merge(workUnit);

            _workUnits.AddOrUpdate(workUnit.Key, AddValue, UpdateValue);
        }
        /// <summary>
        /// Merge this work unit with a subsequent work unit.
        /// </summary>
        /// <param name="second">The subsequent work unit.</param>
        /// <returns>A single work unit that combines the two.</returns>
        /// <remarks>
        /// This is necessary if a transaction has one or more insert/update/delete
        /// in a single transaction.
        /// </remarks>
        public WorkUnit Merge(WorkUnit second)
        {
            if (second is InsertWorkUnit ins)
            {
                return(MergeInsert(ins));
            }

            if (second is UpdateWorkUnit upd)
            {
                return(MergeUpdate(upd));
            }

            if (second is DeleteWorkUnit del)
            {
                return(MergeDelete(del));
            }

            throw new ArgumentException("unknown work unit type");
        }