public void UpdateTask(KanbanTask task)
        {
            KanbanTask oldTask = _context.KanbanTasks.Find(task.Id);

            foreach (var prop in oldTask.GetType().GetProperties())
            {
                prop.SetValue(oldTask, prop.GetValue(task));
            }
            _context.KanbanTasks.Update(task);
            _context.SaveChanges();
        }
        public IActionResult Edit([FromForm] KanbanTask task)
        {
            task.ResponsibleUser = _context.Users.Find(task.ResponsibleUser?.Id) ?? task.ResponsibleUser;
            if (!(User.IsInRole("Organizer") || (User.IsInRole("Team Player"))))
            {
                if (_signInContext.UserManager.GetUserId(User) != TaskManager.Tasks.Where(a => a.Id == task.Id)?.First()?.OwnerRefId)
                {
                    return(RedirectToAction("Index"));
                }
            }

            KanbanTask oldTask = TaskManager.Tasks.Find(t => t.Id == task.Id);

            foreach (var prop in oldTask.GetType().GetProperties())
            {
                prop.SetValue(oldTask, prop.GetValue(task));
            }

            TaskManager.UpdateTask(oldTask);

            return(RedirectToAction("Index"));
        }