private void SubscribeMessagesChanged()
 {
     ChatModel.Messages.CollectionChanged += ((sender, e) =>
     {
         if (e.OldItems != null)
         {
             foreach (MessageModel it in e.OldItems)
             {
                 Messages.RemoveAt(Messages.FindIndex(x => x.MessageModel == it));
             }
         }
         if (e.NewItems != null)
         {
             foreach (MessageModel it in e.NewItems)
             {
                 int i = 0;
                 for (; i < Messages.Count; i++)
                 {
                     if (Messages[i].MessageModel.Id > it.Id)
                     {
                         break;
                     }
                 }
                 var mb = new MessageBlockViewModel(_manager, it);
                 Messages.Insert(i, mb);
             }
         }
     });
 }
 private void InitMessages()
 {
     foreach (var model in ChatModel.Messages)
     {
         var view = new MessageBlockViewModel(_manager, model);
         Messages.Add(view);
     }
 }