/// <summary>
        /// Convert <see cref="Expression"/> into the <see cref="ActivationData"/> instance.
        /// </summary>
        /// <param name="action">The <see cref="Expression"/> instance.</param>
        /// <returns>The <see cref="ActivationData"/> instance.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="action"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentException">Expression body should be of type `MethodCallExpression`</exception>
        /// <exception cref="InvalidOperationException">Expression object should be not null.</exception>
        public ActivationData Convert(Expression <Action> action)
        {
            logger.Trace("Converting Expression<Action> into the ActivationData...");

            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            MethodCallExpression callExpression = action.Body as MethodCallExpression;

            if (callExpression == null)
            {
                throw new ArgumentException("Expression body should be of type `MethodCallExpression`", "action");
            }

            Type instanceType;

            if (callExpression.Object != null)
            {
                var objectValue = cachedExpressionCompiler.GetValue(callExpression.Object);
                if (objectValue == null)
                {
                    throw new InvalidOperationException("Expression object should be not null.");
                }

                instanceType = objectValue.GetType();
            }
            else
            {
                instanceType = callExpression.Method.DeclaringType;
            }

            MethodInfo method = callExpression.Method;

            object[] arguments     = ExtractArguments(callExpression.Arguments);
            Type[]   argumentTypes = method.GetParameters().Select(x => x.ParameterType).ToArray();

            ActivationData result = new ActivationData(instanceType, method, arguments, argumentTypes);

            logger.Trace("Converting Expression<Action> into the TaskActivationDetailsModel has been successfully completed.");

            return(result);
        }
        /// <summary>
        /// <c>Convert</c> <c>object</c> into the JSON.
        /// </summary>
        /// <param name="data">Data.</param>
        /// <returns>JSON.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="data"/> is <see langword="null" />.</exception>
        public string ConvertToJson(object data)
        {
            logger.Trace("Converting {0} into JSON...", data);

            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            string result = JsonConvert.SerializeObject(data, jsonSerializerSettings);

            logger.Trace("The {0} has been converted into JSON: {1}", data, result);
            return(result);
        }