public ActionResult Index(WhiteBoardModel WhiteBoards, IEnumerable <HttpPostedFileBase> Images, IEnumerable <HttpPostedFileBase> Files)
        {
            if (Session["UserId"] != null)
            {
                List <YearsforFaculty> Years = new List <YearsforFaculty>();
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                List <Batches>   Batches     = new List <Batches>();
                int PostId = 0;
                if (ModelState.IsValid)
                {
                    if (WhiteBoards.selections == "Visible To All")
                    {
                        UserPost UserPosts = new UserPost()
                        {
                            EventId     = WhiteBoards.EventId,
                            ViewBy      = WhiteBoards.selections,
                            UserId      = UserId,
                            UserMessage = WhiteBoards.Message,
                            Status      = true,
                            CreatedOn   = DateTime.Now
                        };
                        PostId = UserPostService.InsertUserPosts(UserPosts);

                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId    = PostId,
                            Batch     = WhiteBoards.selections,
                            Branch    = WhiteBoards.Degree,
                            Degreee   = Userdetails.CourseId,
                            CreatedOn = DateTime.Now,
                            Status    = true,
                            BatchTo   = (WhiteBoards.WorkFromTo)
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }
                    else
                    {
                        UserPost UserPosts = new UserPost()
                        {
                            EventId     = WhiteBoards.EventId,
                            UserId      = UserId,
                            UserMessage = WhiteBoards.Message,
                            ViewBy      = WhiteBoards.Batchyear,
                            Status      = true,
                            CreatedOn   = DateTime.Now
                        };
                        PostId = UserPostService.InsertUserPosts(UserPosts);

                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId  = PostId,
                            Batch   = WhiteBoards.WorkFromYear,
                            Branch  = WhiteBoards.Degree,
                            Degreee = Userdetails.CourseId,

                            CreatedOn = DateTime.Now,
                            Status    = true,
                            BatchTo   = (WhiteBoards.WorkFromTo)
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }
                    if (Images != null)
                    {
                        foreach (var Pictures in Images)
                        {
                            if (Pictures != null)
                            {
                                var fileName = Path.GetFileName(Pictures.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                                Pictures.SaveAs(path);
                                var             FilePath   = "/UserPostingImages/" + fileName;
                                UserPost_Images UserImages = new UserPost_Images()
                                {
                                    PostId    = PostId,
                                    ImagePath = FilePath,
                                    CreatedOn = DateTime.Now,
                                    Status    = true
                                };
                                UserpostPictureServices.Create(UserImages);
                            }
                        }
                    }
                    ViewBag.Userdata = GenericMethods.GetUserdetailsonFaculty(UserId, Convert.ToString(Userdetails.Batch));
                    return(RedirectToAction("Index", "WhiteBoard", new { area = "Faculty" }));
                }

                if (Userdetails.RoleId == "2")
                {
                    for (int?i = Userdetails.WorkingFrom; i <= Userdetails.WorkingTo; i++)
                    {
                        Years.Add(new YearsforFaculty {
                            Year = Convert.ToString(i)
                        });
                    }
                }
                WhiteBoardModel WhiteBoard = new WhiteBoardModel()
                {
                    Viewdetails     = Batches,
                    RoleId          = Userdetails.RoleId,
                    Batch           = Userdetails.Batch,
                    Stream          = Userdetails.CourseName,
                    Events          = EventCategoryService.GetCategorys(),
                    yearsList       = Years,
                    Coursecategorys = CategoryServices.GetAllCourseCategories(),
                };
                ViewBag.Userdata = GenericMethods.GetUserdetailsonFaculty(UserId, Convert.ToString(Userdetails.Batch));
                return(View(WhiteBoard));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }