public async Task <IActionResult> ViewMyChannels(ViewMyChannelsAddressModel model)
        {
            var appid    = _tokenManager.ValidateAccessToken(model.AccessToken);
            var appLocal = await _dbContext.Apps.SingleOrDefaultAsync(t => t.Id == appid);

            if (appLocal == null)
            {
                appLocal = new StargateApp
                {
                    Id = appid
                };
                await _dbContext.Apps.AddAsync(appLocal);

                await _dbContext.SaveChangesAsync();
            }
            var channels = _stargateMemory
                           .GetChannelsUnderApp(appid);
            var viewModel = new ViewMyChannelsViewModel
            {
                AppId    = appid,
                Channels = channels,
                Code     = ErrorType.Success,
                Message  = "Successfully get your channels!"
            };

            return(Ok(viewModel));
        }
        public IActionResult PushMessage(PushMessageAddressModel model)
        {
            //Ensure app
            var appid = _tokenManager.ValidateAccessToken(model.AccessToken);
            //Ensure channel
            var channel = _memoryContext.GetChannelsUnderApp(appid).SingleOrDefault(t => t.Id == model.ChannelId);

            if (channel == null)
            {
                return(this.Protocol(ErrorType.NotFound, $"We can not find your channel with id: '{model.ChannelId}'!"));
            }
            //Create Message
            var message = new Message
            {
                Id        = _counter.GetUniqueNo(),
                ChannelId = channel.Id,
                Content   = model.MessageContent
            };

            channel.Push(message);
            return(Ok(new AiurProtocol
            {
                Code = ErrorType.Success,
                Message = $"You have successfully pushed a new message to channel: {channel.Id}!"
            }));
        }