public void PersonCreate(Person entity)
        {
            try
            {
                var Db = this.getContext();

                var p = Db.People.Add(entity);
                Db.SaveChanges();
                //Get from DB since we might miss the Fruit/Color entity due to only setting FK´s on them.
                p.FavoriteFruit = Db.Set<Fruit>().Find(p.FavoriteFruitId);
                p.FavoriteColor = Db.Set<Color>().Find(p.FavoriteColorId);
                var json = new PersonViewModel(p);
                //Notify all clients listening for this event that a new Person was created!
                this.SendToAll(json, Commands.PersonTrigger.Created);
            }
            catch (Exception ex)
            {
                this.DispatchError(ex, "Exception in PersonCreate");
            }
        }
        public void PersonUpdate(Person entity)
        {
            try
            {
                var Db = this.getContext();

                var dbEntity = Db.Set<Person>().Find(entity.Id);

                dbEntity.GenderValue = entity.GenderValue;
                dbEntity.Name = entity.Name;
                dbEntity.FavoriteColorId = entity.FavoriteColorId;
                dbEntity.FavoriteFruitId = entity.FavoriteFruitId;

                Db.Entry(dbEntity).State = EntityState.Modified;

                Db.SaveChanges();

                entity.FavoriteFruit = Db.Set<Fruit>().Find(entity.FavoriteFruitId);
                entity.FavoriteColor = Db.Set<Color>().Find(entity.FavoriteColorId);
                var json = new PersonViewModel(entity);

                //Notify all clients listening for this event that a Person was updated!
                this.SendToAll(json, Commands.PersonTrigger.Updated);
            }
            catch (Exception ex)
            {
                this.DispatchError(ex, "Exception in PersonUpdate");
            }
        }