private ProtocolContext InitContext(string applicationToken, string servicePubKey, string clientPrivKey, string serviceSubdomain)
        {
            var serializer = new HttpBodySerializer();
            var serviceUrl = ServiceUrl.ProvideByToken(applicationToken).Replace("api", serviceSubdomain);
            var client     = new PheHttpClient(serializer, applicationToken, serviceUrl);
            var context    = new ProtocolContext(applicationToken, client, servicePubKey, clientPrivKey);

            return(context);
        }
        /// <summary>
        /// Create the context with passw0rd's application credentials.
        /// How to get passw0rd's application credentials
        /// you will find <see href="https://github.com/passw0rd/cli">here</see>.
        /// </summary>
        /// <returns>The new instance of the <see cref="ProtocolContext"/>
        ///  which contains application credentials.</returns>
        /// <param name="appToken">Application token.</param>
        /// <param name="servicePublicKey">Service public key.</param>
        /// <param name="appSecretKey">Application Secret Key.</param>
        /// <param name="updateToken">Update token.
        /// How to generate Update Token you will find
        /// <see href="https://github.com/passw0rd/cli#get-an-update-token">here</see>.</param>
        public static ProtocolContext Create(
            string appToken,
            string servicePublicKey,
            string appSecretKey,
            string updateToken = null)
        {
            Validation.NotNullOrWhiteSpace(appToken, "Application token isn't provided.");
            Validation.NotNullOrWhiteSpace(servicePublicKey, "Service Public Key isn't provided.");
            Validation.NotNullOrWhiteSpace(appSecretKey, "Application Secret Key isn't provided.");

            var serializer = new HttpBodySerializer();

            var client = new PheHttpClient(serializer, appToken, ServiceUrl.ProvideByToken(appToken));

            var ctx = new ProtocolContext(appToken, client, servicePublicKey, appSecretKey);

            if (!string.IsNullOrWhiteSpace(updateToken))
            {
                ctx.UpdatePheClients(updateToken);
            }

            return(ctx);
        }