public ActionResult Withdrawal(int id, bool type, ProjectWithdrawalModel form)
        {
            if (!_permissionService.Authorize(PermissionProvider.ManageProjects))
                return AccessDeniedView();

            // Get the queue item
            var queue = _moderationQueueService.GetProjectWithdrawalByModerationQueueId(id);
            if (queue == null || queue.Deleted)
                return RedirectToAction("index", "moderation");

            // Check we have a project
            var project = queue.Project;
            if (project == null)
                return RedirectToAction("index");

            var model = queue.ToModel();

            try
            {
                project.ModeratorNotes = form.Project.ModerationNotes;

                if (type)
                {
                    // Update the project properties
                    project.LastModeratorApprovalBy = _workContext.CurrentUser.Id;
                    project.LastModeratorApprovalDate = DateTime.Now;
                    project.Status = ProjectStatus.Withdrawn;

                    // Commit the changes
                    _projectService.UpdateProject(project);
                    SuccessNotification("The action has been withdrawn.");

                    // Queue the messages
                    _messageQueueService.ProjectMessage(project, MessageType.ProjectWithdrawalApproved, form.ModerationQueue.Notes, form.VolunteersMessage);

                    // Remove outstanding project related items from the queue.
                    _moderationQueueService.RemoveAllProjectEntriesByProjectId(project.Id, model.ModerationQueue.Id);
                }
                else
                {
                    // Commit the changes
                    _projectService.UpdateProject(project);
                    SuccessNotification("The action remains active.");

                    // Queue the messages
                    _messageQueueService.ProjectMessage(project, MessageType.ProjectWithdrawalRejected, form.ModerationQueue.Notes);
                }

                // Mark the moderation request as resolved
                var queueUpdate = _moderationQueueService.GetById(id);
                queueUpdate.StatusType = ModerationStatusType.Closed;
                queueUpdate.Notes = form.ModerationQueue.Notes;
                _moderationQueueService.UpdateModerationQueue(queueUpdate);

                return RedirectToRoute("Admin_default", new { Controller = "moderation", Action = "index" });
            }
            catch (Exception)
            {
                ErrorNotification("An error occurred saving the action details, please try again.");
            }

            PrepareModerationBreadcrumbs();
            return View(model);
        }
        public static ProjectWithdrawalModel ToModel(this ProjectWithdrawal entity)
        {
            if (entity == null)
                return null;

            var model = new ProjectWithdrawalModel
            {
                Id = entity.Id,
                Project = entity.Project.ToModel(),
                ModerationQueue = entity.ModerationQueue.ToModel(),
                Reason = entity.Reason
            };

            return model;
        }