public async Task<UserSearchResponse> UserSearch(UserSearchRequest request, SystemSession session)
        {
            var serviceRequest = new UserSearchQuery
            {
                Query = request.Query,
                Cursor = request.Cursor,
                Limit = request.Limit
            };

            var response = await Task.Factory.StartNew(() => Client.SearchService.userSearch(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = new UserSearchResponse
            {
                Cursor = response.Cursor,
                Limit = response.Limit,
                Count = response.Count,

                User = response.Users != null ? response.Users.Select(x => new UserInformationBaseExtendedResponse
                {
                    FirstName = x.UserInfoPerson.FirstName,
                    LastName = x.UserInfoPerson.LastName,
                    Image = x.UserInfo.Picture,
                    Title = x.UserInfo.Title,
                    UserId = Convert.ToInt32(x.UserInfoPerson.UserId),
                    UserName = x.UserName,
                    UserTypeId = (SystemUserType)x.UserInfo.UserTypeId
                }) : null
            };
            return result;
        }
     public UserSearchResult userSearch(UserSearchQuery query, Session session)
     {
 #if !SILVERLIGHT
         send_userSearch(query, session);
         return(recv_userSearch());
 #else
         var asyncResult = Begin_userSearch(null, null, query, session);
         return(End_userSearch(asyncResult));
 #endif
     }
            public void send_userSearch(UserSearchQuery query, Session session)
      #endif
            {
                oprot_.WriteMessageBegin(new TMessage("userSearch", TMessageType.Call, seqid_));
                userSearch_args args = new userSearch_args();

                args.Query   = query;
                args.Session = session;
                args.Write(oprot_);
                oprot_.WriteMessageEnd();
        #if SILVERLIGHT
                return(oprot_.Transport.BeginFlush(callback, state));
        #else
                oprot_.Transport.Flush();
        #endif
            }
            public void Read(TProtocol iprot)
            {
                TField field;

                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Struct)
                        {
                            Query = new UserSearchQuery();
                            Query.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            Session = new Session();
                            Session.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
 public IAsyncResult send_userSearch(AsyncCallback callback, object state, UserSearchQuery query, Session session)
 public IAsyncResult Begin_userSearch(AsyncCallback callback, object state, UserSearchQuery query, Session session)
 {
     return(send_userSearch(callback, state, query, session));
 }
 public void send_userSearch(UserSearchQuery query, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("userSearch", TMessageType.Call, seqid_));
   userSearch_args args = new userSearch_args();
   args.Query = query;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
 public IAsyncResult send_userSearch(AsyncCallback callback, object state, UserSearchQuery query, Session session)
      public UserSearchResult userSearch(UserSearchQuery query, Session session)
      {
        #if !SILVERLIGHT
        send_userSearch(query, session);
        return recv_userSearch();

        #else
        var asyncResult = Begin_userSearch(null, null, query, session);
        return End_userSearch(asyncResult);

        #endif
      }
 public IAsyncResult Begin_userSearch(AsyncCallback callback, object state, UserSearchQuery query, Session session)
 {
   return send_userSearch(callback, state, query, session);
 }
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.Struct) {
           Query = new UserSearchQuery();
           Query.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Session = new Session();
           Session.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }