/// <summary>
        /// get server service attribute from ServiceContractAttribute
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static ServiceContractAttribute GetServerServiceAttribute(this Type type, string serviceName, bool isClient)
        {
            ServiceContractAttribute serviceContract = type.GetCustomAttributes <ServiceContractAttribute>(true).Where(x => x.ServiceType == ServiceType.ServerService || x.ServiceType == ServiceType.HttpService || x.ServiceType == ServiceType.StreamService || x.ServiceType == ServiceType.OneWayService).Where(x => x.GetServiceName(isClient).Equals(serviceName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

            if (serviceContract == null)
            {
                throw new Exception("your server class must have ServiceContract attribute that have ServiceType == ServiceType.SeverService parameter");
            }
            return(serviceContract);
        }
        /// <summary>
        /// get client service attribute from ServiceContractAttribute
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static ServiceContractAttribute GetClientServiceAttribute(this Type type)
        {
            ServiceContractAttribute serviceContract = type.GetCustomAttributes <ServiceContractAttribute>(true).Where(x => x.ServiceType == ServiceType.ClientService).FirstOrDefault();

            if (serviceContract == null)
            {
                throw new Exception("your client class must have ServiceContract attribute that have ServiceType == ServiceType.ClientService parameter");
            }
            return(serviceContract);
        }
 /// <summary>
 /// get service name from ServiceContractAttribute
 /// </summary>
 /// <param name="serviceContract"></param>
 /// <returns></returns>
 public static string GetServiceName(this ServiceContractAttribute serviceContract, bool isClient)
 {
     if (isClient)
     {
         return(serviceContract.Name.ToLower());
     }
     if (serviceContract.ServiceType == ServiceType.HttpService)
     {
         return(serviceContract.Name.ToLower());
     }
     return((serviceContract.Name + serviceContract.ServiceType.ToString()).ToLower());
 }