// Contact list returned
        private void OnContactListReturned(object sender, GetContactListEventArgs e)
        {
            JObject rawJson = JObject.Parse(e.Response);
            JObject rootJson = (JObject)rawJson["contacts"];
            ContactCount = int.Parse(rootJson["total"].ToString());
            int page = int.Parse(rootJson["page"].ToString());
            int numPages = int.Parse(rootJson["pages"].ToString());
            int perPage = int.Parse(rootJson["perpage"].ToString());

            List<User> newUsers = new List<User>();
            if (ContactCount > 0)
            {
                foreach (var entry in rootJson["contact"])
                {
                    JObject json = (JObject)entry;
                    User contact = UserFactory.ContactWithJObject(json);

                    if (!ContactList.Contains(contact))
                    {
                        ContactList.Add(contact);
                        newUsers.Add(contact);
                    }
                }
            }

            // Dispatch event
            ContactListUpdatedEventArgs evt = new ContactListUpdatedEventArgs();
            evt.Page = page;
            evt.PageCount = numPages;
            evt.PerPage = perPage;
            evt.NewUsers = newUsers;
            ContactListUpdated.DispatchEvent(this, evt);
        }
        private void OnContactListUpdated(object sender, ContactListUpdatedEventArgs e)
        {
            Dispatcher.BeginInvoke(() => {
                if (SystemTray.ProgressIndicator != null)
                    SystemTray.ProgressIndicator.IsVisible = false;

                if (Cinderella.CinderellaCore.ContactList.Count == 0)
                {
                    StatusLabel.Text = AppResources.NoContactsText;
                    StatusLabel.Visibility = Visibility.Visible;
                }
                else
                {
                    StatusLabel.Visibility = Visibility.Collapsed;
                }

                foreach (var contact in e.NewUsers)
                {
                    if(!UserCollection.Contains(contact))
                        UserCollection.Add(contact);
                }
            });
        }