private List <Models.MatchEventModel> CreateEvents(IEnumerable <LocalDB.Tables.Event> events)
        {
            var eventmodels = new List <Models.MatchEventModel>();

            foreach (var e in events)
            {
                if (e.Type != EventType.A)
                {
                    var eventModel = new Models.MatchEventModel {
                        Id = e.Id
                    };

                    if (e.TeamId == HomeTeam.Id)
                    {
                        eventModel.Player   = HomeTeam.Players.Where(p => p.Id == e.PlayerId).First();
                        eventModel.ViewType = 0;
                    }
                    else
                    {
                        eventModel.Player   = AwayTeam.Players.Where(p => p.Id == e.PlayerId).First();
                        eventModel.ViewType = 1;
                    }

                    if (e.Type == EventType.P2 || e.Type == EventType.P10)
                    {
                        eventModel.ResourceId = Resource.Drawable.ic_numeric_2_box_grey600_24dp;
                    }
                    else
                    {
                        if (e.Type == EventType.P5)
                        {
                            eventModel.ResourceId = Resource.Drawable.ic_numeric_2_box_grey600_24dp;
                        }
                        else
                        {
                            if (e.Type == EventType.G)
                            {
                                eventModel.ResourceId = Resource.Drawable.ball;
                                eventModel.IsGoal     = true;
                            }
                        }
                    }

                    eventModel.Time = e.Time;
                    eventmodels.Add(eventModel);
                }
            }

            return(eventmodels);
        }
        protected override void NewEventAdded(int eventId)
        {
            base.NewEventAdded(eventId);

            Event e = UoW.EventRepo.GetEventById(eventId);

            if (e.Type != EventType.A)
            {
                var eventModel = new Models.MatchEventModel {
                    Id = e.Id
                };

                eventModel.Player = UoW.PlayerRepo.GetPlayerById(e.PlayerId);

                Match.Time = Match.Time < e.Time ? e.Time : Match.Time;

                Activity.RunOnUiThread(() =>
                {
                    View.FindViewById <TextView>(Resource.Id.actualTime).Text = UIHelper.GetMatchFullTime(Match.Time);
                });

                if (e.TeamId == HomeTeam.Id)
                {
                    eventModel.ViewType = 0;
                }
                else
                {
                    eventModel.ViewType = 1;
                }

                if (e.Type == EventType.P2 || e.Type == EventType.P10)
                {
                    eventModel.ResourceId = Resource.Drawable.ic_numeric_2_box_grey600_24dp;
                }
                else
                {
                    if (e.Type == EventType.P5)
                    {
                        eventModel.ResourceId = Resource.Drawable.ic_numeric_2_box_grey600_24dp;
                    }
                    else
                    {
                        if (e.Type == EventType.G)
                        {
                            eventModel.IsGoal = true;
                            if (e.TeamId == HomeTeam.Id)
                            {
                                Match.ScoreH++;
                                Activity.RunOnUiThread(() =>
                                {
                                    View.FindViewById <TextView>(Resource.Id.homeTeamScore).Text = Match.ScoreH.ToString();
                                });
                            }
                            else
                            {
                                Match.ScoreA++;
                                Activity.RunOnUiThread(() =>
                                {
                                    View.FindViewById <TextView>(Resource.Id.awayTeamScore).Text = Match.ScoreA.ToString();
                                });
                            }
                            eventModel.ResourceId = Resource.Drawable.ball;
                            var assist = UoW.EventRepo.GetAssisByGoal(e.Id);
                            if (assist != null)
                            {
                                eventModel.Assist = new MatchEventModel {
                                    ResourceId = Resource.Drawable.ball, Player = Match.Players.First(p => p.Id == assist.PlayerId)
                                };
                            }
                        }
                    }
                }

                eventModel.Time         = e.Time;
                eventModel.EventMessage = UoW.EventMessageRepo.GetEventMessageById(e.EventMessageId);
                Events.Add(eventModel);
                Events = Events.OrderByDescending(ev => ev.Time).ToList();
                Activity.RunOnUiThread(() =>
                {
                    adapter.Swap(Events.ToList());
                });
            }
        }