public void AddParticipant(WishlistParticipant wp)
 {
     try
     {
         using (WishlistDbContext context = new WishlistDbContext())
         {
             context.Participants.Add(wp);
             context.SaveChanges();
         }
     }
     catch (Exception eContext)
     {
         Debug.WriteLine("Exception: " + eContext.Message);
     }
 }
        public void RespondToMessage(Message msg)
        {
            //Message response;
            //User Receiver = GetUserById(msg.IdSender);
            //MessageUser mu;

            //update message in db, Updates IsAccepted status
            UpdateMessage(msg);

            //If Message accepted
            if (msg.IsAccepted.GetValueOrDefault())
            {
                //if wishlistid null add sender and user to usercontact in db
                if (msg.WishlistId == null)
                {
                    AddContact(msg);
                    //response = new Message(User, msg.Sender, false);
                }
                //if wishlistid not null, add related user and relatedwishlist to wishparticipant in db
                else
                {
                    //If responding to request to join
                    if (msg.MessageContent.Contains("Has invited you"))
                    {
                        WishlistParticipant wp = new WishlistParticipant(msg.WishlistId.GetValueOrDefault(), User.UserId, null, null);  //getvalueorDefault to deal with nullability of wishlistid
                        AddParticipant(wp);
                    }
                    //if responding to request to be added to wishlist
                    else if (msg.MessageContent.Contains("Wishes to participate"))
                    {
                        WishlistParticipant wp = new WishlistParticipant(msg.WishlistId.GetValueOrDefault(), msg.IdSender, null, null);  //getvalueorDefault to deal with nullability of wishlistid
                        AddParticipant(wp);
                    }
                }
            }

            //Update loggedinuser to shown new wishlists or messages
            SetupLoggedInUser(User);
        }