public ActionResult CreatePost(int groupId, string content, HttpPostedFileBase picture, HttpPostedFileBase attachement)
        {
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("Error"));
            }

            if (content == "" && picture == null && attachement == null)
            {
                return(RedirectToAction("Home", "Home"));
            }
            else
            {
                int    postOwnerId        = Int32.Parse(Session["UserId"].ToString());
                string postAttachementUrl = null;
                string pictureUrl         = null;
                string attachementName    = null;

                if (picture != null && picture.ContentLength > 0)
                {
                    var           fileName     = Path.GetFileName(picture.FileName);
                    List <string> imgExtension =
                        new List <string>(new string[] { ".gif", ".png", ".PNG", ".jpg", ".jpeg", ".bmp", ".tiff" });

                    string extension = Path.GetExtension(fileName);
                    if (imgExtension.Contains(extension))
                    {
                        var path = Path.Combine(Server.MapPath("~/Content/post/images"),
                                                postOwnerId.ToString() + DateTime.Now.ToString("yyyyMMdd") + fileName);

                        if (!System.IO.File.Exists(fileName))
                        {
                            picture.SaveAs(path);
                        }

                        pictureUrl = "~/Content/post/images/" + postOwnerId.ToString() + DateTime.Now.ToString("yyyyMMdd") +
                                     Path.GetFileName(picture.FileName);
                    }
                }

                if (attachement != null && attachement.ContentLength > 0)
                {
                    attachementName = Path.GetFileName(attachement.FileName);
                    List <string> filesExtension =
                        new List <string>(new string[] { ".txt", ".pdf", ".ppt", ".docx" });

                    string extension = Path.GetExtension(attachementName);
                    if (filesExtension.Contains(extension))
                    {
                        var path = Path.Combine(Server.MapPath("~/Content/post/attachement"),
                                                postOwnerId.ToString() + DateTime.Now.ToString("yyyyMMdd") + attachementName);

                        if (!System.IO.File.Exists(attachementName))
                        {
                            attachement.SaveAs(path);
                        }

                        postAttachementUrl = "~/Content/post/attachement/" + postOwnerId.ToString() + DateTime.Now.ToString("yyyyMMdd") +
                                             Path.GetFileName(attachement.FileName);
                    }
                }

                KoombuBll kBll = new KoombuBll();
                kBll.CreatePost(content, postOwnerId, groupId, pictureUrl, postAttachementUrl, attachementName);
                if (groupId != 0)
                {
                    return(RedirectToAction("GroupWall", "Group", new { groupId = groupId }));
                }
            }

            return(RedirectToAction("Home", "Home"));
        }