public ActionResult DeleteUploadedFile(Guid id)
        {
            if (id != Guid.Empty)
            {
                using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
                {
                    Topic topic   = null;
                    var   message = new GenericMessageViewModel();
                    try
                    {
                        // Get the file and associated objects we'll need
                        var uploadedFile = UploadedFileService.Get(id);
                        var post         = uploadedFile.Post;
                        topic = post.Topic;

                        if (_membersGroup.Name == AppConstants.AdminRoleName || uploadedFile.MemberId == CurrentMember.Id)
                        {
                            // Ok to delete file
                            // Remove it from the post
                            post.Files.Remove(uploadedFile);

                            // store the file path as we'll need it to delete on the file system
                            var filePath = uploadedFile.FilePath;

                            // Now delete it
                            UploadedFileService.Delete(uploadedFile);


                            // And finally delete from the file system
                            System.IO.File.Delete(Server.MapPath(filePath));
                        }
                        else
                        {
                            message.Message     = Lang("Errors.NoPermission");
                            message.MessageType = GenericMessages.Danger;
                            ShowMessage(message);

                            Redirect(topic.Url);
                        }

                        //Commit
                        unitOfWork.Commit();

                        message.Message     = Lang("Post.FileSuccessfullyDeleted");
                        message.MessageType = GenericMessages.Success;
                        ShowMessage(message);

                        return(Redirect(topic.Url));
                    }
                    catch (Exception ex)
                    {
                        unitOfWork.Rollback();
                        LogError(ex);

                        message.Message     = Lang("Errors.GenericMessage");
                        message.MessageType = GenericMessages.Danger;
                        ShowMessage(message);

                        return(topic != null?Redirect(topic.Url) : ErrorToHomePage(Lang("Errors.GenericMessage")));
                    }
                }
            }
            return(ErrorToHomePage(Lang("Errors.GenericMessage")));
        }