public ActionResult Create([Bind(Include = "Subject,Message,Receiver")] CreateNewPostViewModel post)
        {
            if (ModelState.IsValid)
            {
                Post newPost = new Post();

                newPost.Subject = post.Subject;
                newPost.Message = post.Message;
                newPost.Timestamp = DateTime.Now;
                newPost.Read = false;
                newPost.Deleted = false;

                // Get ApplicationUser object of sender and receiver and add to newPost
                var CurrentUser = db.Users.Find(User.Identity.GetUserId());
                var receiver = db.Users.Where(u => u.UserName == post.Receiver).FirstOrDefault();
                newPost.Sender = CurrentUser;
                newPost.Receiver = receiver;

                db.Posts.Add(newPost);
                db.SaveChanges();

                // Put a message in TempData so the GET method of Create can put the message in the viewbag for the view
                TempData["successMessage"] = "Message was sent to " + newPost.Receiver.UserName + " at " + newPost.Timestamp;

                return RedirectToAction("Create");
            }

            return View(post);
        }
        public ActionResult CreateMulticast([Bind(Include = "Subject,Message,Receivers")] CreateNewMulticastPostViewModel post)
        {
            if (ModelState.IsValid)
            {

                string[] parts = post.Receivers.Split(' ');

                if (parts.Length > 0)
                {
                    foreach (string part in parts)
                    {
                        Post newPost = new Post();

                        newPost.Subject = post.Subject;
                        newPost.Message = post.Message;
                        newPost.Timestamp = DateTime.Now;
                        newPost.Read = false;
                        newPost.Deleted = false;

                        var CurrentUser = db.Users.Find(User.Identity.GetUserId());
                        newPost.Sender = CurrentUser;
                        var receiver = db.Users.Where(u => u.UserName == part).FirstOrDefault();

                        if(receiver == null)
                        {
                            continue;
                        }

                        newPost.Receiver = receiver;

                        db.Posts.Add(newPost);
                    }
                    db.SaveChanges();
                    return RedirectToAction("Create");
                }
            }
            return View();
        }