public NodeId StartNewKeyPairRequest(
            NodeId applicationId,
            string certificateGroupId,
            string certificateTypeId,
            string subjectName,
            string[] domainNames,
            string privateKeyFormat,
            string privateKeyPassword,
            string authorityId)
        {
            string appId = OpcVaultClientHelper.GetServiceIdFromNodeId(applicationId, NamespaceIndex);

            if (string.IsNullOrEmpty(appId))
            {
                throw new ServiceResultException(StatusCodes.BadInvalidArgument, "The ApplicationId is invalid.");
            }

            if (String.IsNullOrWhiteSpace(certificateTypeId))
            {
                throw new ServiceResultException(StatusCodes.BadInvalidArgument, "The CertificateTypeId does not refer to a supported CertificateType.");
            }

            if (String.IsNullOrWhiteSpace(certificateGroupId))
            {
                throw new ServiceResultException(StatusCodes.BadInvalidArgument, "The CertificateGroupId does not refer to a supported CertificateGroup.");
            }

            try
            {
                var model = new CreateNewKeyPairRequestApiModel(
                    appId,
                    certificateGroupId,
                    certificateTypeId,
                    subjectName,
                    domainNames,
                    privateKeyFormat,
                    privateKeyPassword
                    );

                string requestId = _opcVaultServiceClient.CreateNewKeyPairRequest(model);

                return(OpcVaultClientHelper.GetNodeIdFromServiceId(requestId, NamespaceIndex));
            }
            catch (HttpOperationException httpEx)
            {
                // TODO: return matching ServiceResultException
                //throw new ServiceResultException(StatusCodes.BadNodeIdUnknown);
                //throw new ServiceResultException(StatusCodes.BadInvalidArgument);
                //throw new ServiceResultException(StatusCodes.BadUserAccessDenied);
                throw new ServiceResultException(httpEx, StatusCodes.BadRequestNotAllowed);
            }
        }
        public NodeId StartSigningRequest(
            NodeId applicationId,
            string certificateGroupId,
            string certificateTypeId,
            byte[] certificateRequest,
            string authorityId)
        {
            string appId = OpcVaultClientHelper.GetServiceIdFromNodeId(applicationId, NamespaceIndex);

            if (string.IsNullOrEmpty(appId))
            {
                throw new ServiceResultException(StatusCodes.BadNotFound, "The ApplicationId is invalid.");
            }

            if (String.IsNullOrWhiteSpace(certificateTypeId))
            {
                throw new ServiceResultException(StatusCodes.BadInvalidArgument, "The CertificateTypeId does not refer to a supported CertificateType.");
            }

            if (String.IsNullOrWhiteSpace(certificateGroupId))
            {
                throw new ServiceResultException(StatusCodes.BadInvalidArgument, "The CertificateGroupId does not refer to a supported CertificateGroup.");
            }

            try
            {
                var model = new CreateSigningRequestApiModel(
                    appId,
                    certificateGroupId,
                    certificateTypeId,
                    Convert.ToBase64String(certificateRequest)
                    );

                string requestId = _opcVaultServiceClient.CreateSigningRequest(model);
                return(OpcVaultClientHelper.GetNodeIdFromServiceId(requestId, NamespaceIndex));
            }
            catch (HttpOperationException httpEx)
            {
                // TODO: return matching ServiceResultException
                //throw new ServiceResultException(StatusCodes.BadNotFound);
                //throw new ServiceResultException(StatusCodes.BadInvalidArgument);
                //throw new ServiceResultException(StatusCodes.BadUserAccessDenied);
                //throw new ServiceResultException(StatusCodes.BadRequestNotAllowed);
                //throw new ServiceResultException(StatusCodes.BadCertificateUriInvalid);
                throw new ServiceResultException(httpEx, StatusCodes.BadNotSupported);
            }
        }