public static T ExecuteNonQuery <T>(this IDatabaseAccessor instance, string commandText, dynamic parameterValues)
        {
            T returnValue = default(T);

            using (SqlConnection connection = instance.CreateConnection())
            {
                string outputValue = null;
                connection.Open();
                SqlCommand command = instance.CreateCommand(connection, commandText, CommandType.StoredProcedure);
                IEnumerable <PropertyInfo> properties = ((Type)parameterValues.GetType()).GetProperties().Where(property => property.CanRead);
                properties.ForEach(property =>
                {
                    object value                 = property.GetValue(parameterValues, null);
                    SqlDbType?valType            = null;
                    ParameterDirection direction = ParameterDirection.Input;
                    string parameterName         = property.Name;
                    if (parameterName.StartsWith("_"))
                    {
                        direction     = ParameterDirection.InputOutput;
                        parameterName = parameterName.Substring(1);
                        outputValue   = parameterName;
                    }
                    if (!parameterName.Equals("IncludeDeleted", StringComparison.OrdinalIgnoreCase))
                    {
                        command.SetParameter(parameterName, value, direction, valType);
                    }
                    else
                    {
                        command.SetIncludeDeletedParameter((bool)value);
                    }
                });

                var reader = command.ExecuteNonQuery();
                if (outputValue != null)
                {
                    returnValue = (T)command.GetParameter(outputValue);
                }
            }
            return(returnValue);
        }
 public static object GetParameter(this SqlCommand command, string parameterName)
 {
     return(command.GetParameter <object>(parameterName));
 }