public async Task RestPresenceSamples()
        {
            AblyRest rest    = new AblyRest("{{API_KEY}}");
            var      channel = rest.Channels.Get("{{RANDOM_CHANNEL_NAME}}");
            PaginatedResult <PresenceMessage> membersPage = await channel.Presence.GetAsync();

            Console.WriteLine(membersPage.Items.Count + " members in first page");
            if (membersPage.HasNext)
            {
                PaginatedResult <PresenceMessage> nextPage = await membersPage.NextAsync();

                Console.WriteLine(nextPage.Items.Count + " members on 2nd page");
            }

            //History
            PaginatedResult <PresenceMessage> eventsPage = await channel.Presence.HistoryAsync();

            Console.WriteLine(eventsPage.Items.Count + " presence events received in first page");
            if (eventsPage.HasNext)
            {
                PaginatedResult <PresenceMessage> nextPage = await eventsPage.NextAsync();

                Console.WriteLine(nextPage.Items.Count + " presence events received in 2nd page");
            }
        }
        public async Task HistoryExample2()
        {
            var realtime = new AblyRealtime("{{API_KEY}}");
            var channel  = realtime.Channels.Get("{{RANDOM_CHANNEL_NAME}}");
            await channel.AttachAsync();

            PaginatedResult <Message> resultPage = await channel.HistoryAsync(untilAttach : true);

            Message lastMessage = resultPage.Items[0];

            Console.WriteLine("Last message before attach: " + lastMessage.Data);


            //Part of the _paginated_result sample
            PaginatedResult <Message> firstPage = await channel.HistoryAsync(null);

            Message firstMessage = firstPage.Items[0];

            Console.WriteLine("Page 0 item 0: " + firstMessage.Data);
            if (firstPage.HasNext)
            {
                var nextPage = await firstPage.NextAsync();

                Console.WriteLine("Page 1 item 1:" + nextPage.Items[1].Data);
                Console.WriteLine("More pages?: " + nextPage.HasNext);
            }
        }
        public async Task RestChannelHistory()
        {
            AblyRest rest    = new AblyRest("{{API_KEY}}");
            var      channel = rest.Channels.Get("{{RANDOM_CHANNEL_NAME}}");

            PaginatedResult <Message> resultPage = await channel.HistoryAsync();

            Console.WriteLine(resultPage.Items.Count + " messages received in first page");
            if (resultPage.HasNext)
            {
                PaginatedResult <Message> nextPage = await resultPage.NextAsync();

                Console.WriteLine(nextPage.Items.Count + " messages received in second page");
            }
        }
        public async Task PresenceExample()
        {
            var options = new ClientOptions("{{API_KEY}}")
            {
                ClientId = "bob"
            };
            var realtime = new AblyRealtime(options);
            var channel  = realtime.Channels.Get("{{RANDOM_CHANNEL_NAME}}");

            channel.Presence.Subscribe(member => Console.WriteLine("Member " + member.ClientId + " : " + member.Action));
            await channel.Presence.EnterAsync(null);

            /* Subscribe to presence enter and update events */
            channel.Presence.Subscribe(member =>
            {
                switch (member.Action)
                {
                case PresenceAction.Enter:
                case PresenceAction.Update:
                    {
                        Console.WriteLine(member.Data);     // => travelling North
                        break;
                    }
                }
            });

            /* Enter this client with data and update once entered */
            await channel.Presence.EnterAsync("not moving");

            await channel.Presence.EnterAsync("travelling North");

            IEnumerable <PresenceMessage> presence = await channel.Presence.GetAsync();

            Console.WriteLine($"There are {presence.Count()} members on this channel");
            Console.WriteLine($"The first member has client ID: {presence.First().ClientId}");

            PaginatedResult <PresenceMessage> resultPage = await channel.Presence.HistoryAsync(untilAttach : true);

            Console.WriteLine(resultPage.Items.Count + " presence events received in first page");
            if (resultPage.HasNext)
            {
                PaginatedResult <PresenceMessage> nextPage = await resultPage.NextAsync();

                Console.WriteLine(nextPage.Items.Count + " presence events received in 2nd page");
            }
        }