public ActionResult _EditMessage(PD_Message_ViewModel model)
        {
            var _p = _db.PD_Processes.Find(model.PD_Process_Id);
            if (User.Identity.Name.Equals(_p.LockedBy))
            {
                var message = _db.PD_Messages.Find(model.PD_Process_Id, model.Id);
                message.PD_MessageType_Process_Id = model.PD_Process_Id;
                message.PD_MessageType_Id = Int16.Parse(model.SelectedMessageType);

                _db.SaveChanges();

                updateGlobalparameters(message);

                return RedirectToAction("ViewProcess", new { processid = model.PD_Process_Id, edit = 1 });
            }
            else
            {
                return null;
            }
        }
        public ActionResult _EditMessage(int processid, int messageid, int edit)
        {
            var message = _db.PD_Messages.Find(processid, messageid);
            PD_Message_ViewModel model;
            if (message != null)
            {
                model = new PD_Message_ViewModel() { PD_Process_Id = message.PD_Process_Id, Id = message.Id };
            }
            else
            {
                model = null;
            }
            List<SelectListItem> availableTypes = new List<SelectListItem>();

            _db.PD_MessageTypes.Where(result => result.PD_Process_Id == processid).ToList().ForEach(mt => availableTypes.Add(new SelectListItem() { Value = "" + mt.Id, Text = mt.Name }));

            //if (message.From == message.To) a = 1;

            if (message.PD_MessageType != null)
            {
                model.SelectedMessageType = "" + message.PD_MessageType.Id;
                availableTypes.Find(result => result.Value == model.SelectedMessageType).Selected = true;
            }
            
            model.AvailableMessageTypes = availableTypes;

            ViewBag.Edit = edit;
            return PartialView(model);
        }