private static ConversationsInfo CreateConversationsInfo(string id, UserProfile profile)
        {
            var conversationInfoList = new ConversationsInfo
            {
                Id = id,
                LastModifiedUnixTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
                Recipient            = profile
            };

            return(conversationInfoList);
        }
        public async Task <GetConversationsResult> GetConversations(string username, string continuationToken, int limit, long lastSeenConversationTime)
        {
            try
            {
                var feedOptions = new FeedOptions
                {
                    MaxItemCount = limit,
                    EnableCrossPartitionQuery = false,
                    RequestContinuation       = continuationToken,
                    PartitionKey = new PartitionKey("c_" + username)
                };

                IQueryable <DocumentDbConversationEntity> query = _documentClient.CreateDocumentQuery <DocumentDbConversationEntity>(DocumentCollectionUri, feedOptions)
                                                                  .Where(conversation => conversation.LastModifiedUnixTime > lastSeenConversationTime).OrderByDescending(entity => entity.LastModifiedUnixTime);

                FeedResponse <DocumentDbConversationEntity> feedResponse = await query.AsDocumentQuery().ExecuteNextAsync <DocumentDbConversationEntity>();

                var conversationsInfo = new List <ConversationsInfo>();
                var conversationsList = feedResponse.Select(ToConversation).ToList();

                foreach (var conversation in conversationsList)
                {
                    var conversationInfo = new ConversationsInfo
                    {
                        Id = conversation.Id.Remove(0, 2),
                        LastModifiedUnixTime = conversation.LastModifiedUnixTime,
                        Recipient            = new UserProfile()
                    };
                    conversationsInfo.Add(conversationInfo);
                }

                return(new GetConversationsResult
                {
                    ContinuationToken = feedResponse.ResponseContinuation,
                    Conversations = conversationsInfo
                });
            }
            catch (DocumentClientException e)
            {
                if (e.StatusCode == HttpStatusCode.NotFound)
                {
                    throw new ConversationNotFoundException($"{username} was not found");
                }
                throw new StorageErrorException($"Failed to retrieve conversations from User {username}",
                                                e, (int)e.StatusCode);
            }
        }