/// <summary>
        /// Returns the name of the service or an anonymous default if it does
        /// not have a name.
        /// </summary>

        public static string GetServiceName(IRpcService service, string anonymousName)
        {
            if (service == null)
                throw new ArgumentNullException("service");

            string name = null;
    
            JsonRpcServiceClass clazz = service.GetClass();
    
            if (clazz != null)
                name = clazz.Name;
    
            return Mask.EmptyString(name, anonymousName);
        }