/// <summary>
        /// Return Application instance by name or create it if it is missing
        /// </summary>
        /// <param name="application">IApplication instance</param>
        /// <param name="data">Options to create application (property Name is required and  used to search application too)</param>
        /// <param name="host">Host of the web application</param>
        /// <param name="useHttps">Use or not HTTPS for Bandwidth event callbacks</param>
        /// <param name="cancellationToken">Cancellation token</param>
        /// <returns>Id of existing (or created) application</returns>
        public static async Task <string> GetOrCreateAsync(this IApplication application, CreateApplicationData data, string host, bool useHttps = true, CancellationToken?cancellationToken = null)
        {
            data.Name = $"{data.Name} on {host}";
            var app = application.GetByName(data.Name);

            if (app != null)
            {
                return(app.Id);
            }
            var baseUrl = $"http{(useHttps ? "s" : "")}://{host}";

            data.IncomingCallUrl    = data.IncomingCallUrl ?? $"{baseUrl}{CallCallbackPath}";
            data.IncomingMessageUrl = data.IncomingMessageUrl ?? $"{baseUrl}{MessageCallbackPath}";
            data.AutoAnswer         = data.AutoAnswer ?? true;
            data.CallbackHttpMethod = data.CallbackHttpMethod ?? CallbackHttpMethod.Post;
            return(await application.CreateAsync(data, cancellationToken));
        }