public void RemoveSticker(TLDocumentBase document) { for (var i = 0; i < Documents.Count; i++) { if (Documents[i].Index == document.Index) { Documents.RemoveAt(i); break; } } Hash = TLUtils.GetFavedStickersHash(Documents); var document54 = document as TLDocument54; if (document54 != null) { var emoticon = document54.Emoticon; if (!string.IsNullOrEmpty(emoticon)) { for (var i = 0; i < Packs.Count; i++) { if (Packs[i].Emoticon.ToString() == emoticon) { for (int j = 0; j < Packs[i].Documents.Count; j++) { if (Packs[i].Documents[j].Value == document54.Index) { Packs[i].Documents.RemoveAt(j); break; } } if (Packs[i].Documents.Count == 0) { Packs.RemoveAt(i); break; } } } } } }