/// <summary>
        /// Await the given task and returns its value of null if the task is a void.
        /// </summary>
        /// <param name="task">The task to run.</param>
        /// <returns>Null if the task is a void.</returns>
        internal async System.Threading.Tasks.Task <dynamic> RunTask(System.Threading.Tasks.Task task)
        {
            await task;

            if (!task.GetType().IsGenericType)
            {
                task.Dispose();
                return(null);
            }
            else
            {
                return(task);
            }
        }
        /// <summary>
        /// Returns the result of a task. If the task does not return a result, this method will return null.
        /// </summary>
        /// <param name="task">The task to run.</param>
        /// <returns>Null if there is not result.</returns>
        internal dynamic RunTaskSynchronously(System.Threading.Tasks.Task task)
        {
            task.Wait();
            var type = task.GetType();

            if (!type.IsGenericType)
            {
                task.Dispose();
                return(null);
            }
            else
            {
                dynamic result = type.GetProperty(nameof(System.Threading.Tasks.Task <System.Object> .Result)).GetValue(task);
                task.Dispose();
                return(result);
            }
        }