private bool EqualsVariables(IReadOnlyDictionary <string, object?> others)
        {
            // the variables dictionary is the same or both are null.
            if (ReferenceEquals(_variables, others))
            {
                return(true);
            }

            if (_variables.Count != others.Count)
            {
                return(false);
            }

            foreach (var key in _variables.Keys)
            {
                if (!_variables.TryGetValue(key, out object?a) ||
                    !others.TryGetValue(key, out object?b))
                {
                    return(false);
                }

                if (a is IEnumerable e1 && b is IEnumerable e2)
                {
                    // Check the contents of the collection, assuming order is important
                    if (!ComparisonHelper.SequenceEqual(e1, e2))
                    {
                        return(false);
                    }
                }