public static void SetNewMethod(this SmartObject smartObject, string methodName, bool ignoreCase = true, bool clearPropertyValues = true)
        {
            smartObject.ThrowIfNull("smartObject");

            var stringComparison = StringComparison.InvariantCultureIgnoreCase;

            if (!ignoreCase)
            {
                stringComparison = StringComparison.InvariantCulture;
            }

            if (clearPropertyValues)
            {
                smartObject.ClearPropertyValues();
            }

            foreach (var method in smartObject.AllMethods)
            {
                if (method.Name.Equals(methodName, stringComparison))
                {
                    smartObject.MethodToExecute = method.Name;
                }

                if (clearPropertyValues)
                {
                    foreach (SmartParameter parameter in method.Parameters)
                    {
                        parameter.Value = null;
                    }
                }
            }
        }