public HttpResponseMessage CreateSplit(CreateSplitDTO dto)
        {
            if (dto.NewTopicId == dto.OldTopicId)
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }

            var portalSettings = PortalSettings;
            var userInfo       = portalSettings.UserInfo;
            var forumUser      = new UserController().GetUser(portalSettings.PortalId, ActiveModule.ModuleID, userInfo.UserID);

            var fc = new ForumController();

            var forum_out = fc.Forums_Get(portalSettings.PortalId, ActiveModule.ModuleID, 0, forumUser.UserId, false, true, dto.OldTopicId);
            var forum_in  = fc.GetForum(portalSettings.PortalId, ActiveModule.ModuleID, dto.NewForumId);

            if (forum_out != null && forum_in != null)
            {
                var perm = false;

                if (forum_out == forum_in)
                {
                    perm = Permissions.HasPerm(forum_out.Security.View, forumUser.UserRoles);
                }
                else
                {
                    perm = Permissions.HasPerm(forum_out.Security.View, forumUser.UserRoles) && Permissions.HasPerm(forum_in.Security.View, forumUser.UserRoles);
                }

                var modSplit = Permissions.HasPerm(forum_out.Security.ModSplit, forumUser.UserRoles);

                if (perm && modSplit)
                {
                    var tc = new TopicsController();

                    int topicId;

                    if (dto.NewTopicId < 1)
                    {
                        var subject      = Utilities.CleanString(portalSettings.PortalId, dto.Subject, false, EditorTypes.TEXTBOX, false, false, ActiveModule.ModuleID, string.Empty, false);
                        var replies      = dto.Replies.Split('|');
                        var rc           = new DotNetNuke.Modules.ActiveForums.DAL2.ReplyController();
                        var firstReply   = rc.Get(Convert.ToInt32(replies[0]));
                        var cc           = new ContentController();
                        var firstContent = cc.Get(firstReply.ContentId);
                        topicId = tc.Topic_QuickCreate(portalSettings.PortalId, ActiveModule.ModuleID, dto.NewForumId, subject, string.Empty, firstContent.AuthorId, firstContent.AuthorName, true, Request.GetIPAddress());
                        tc.Replies_Split(dto.OldTopicId, topicId, dto.Replies, true);
                    }
                    else
                    {
                        topicId = dto.NewTopicId;
                        tc.Replies_Split(dto.OldTopicId, topicId, dto.Replies, false);
                    }
                }
            }
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
        public HttpResponseMessage CreateSplit(CreateSplitDTO dto)
        {
            if (dto.NewTopicId == dto.OldTopicId) return Request.CreateResponse(HttpStatusCode.OK);

            var portalSettings = PortalSettings;
            var userInfo = portalSettings.UserInfo;
            var forumUser = new UserController().GetUser(portalSettings.PortalId, ActiveModule.ModuleID, userInfo.UserID);

            var fc = new ForumController();

            var forum_out = fc.Forums_Get(portalSettings.PortalId, ActiveModule.ModuleID, 0, forumUser.UserId, false, true, dto.OldTopicId);
            var forum_in = fc.GetForum(portalSettings.PortalId, ActiveModule.ModuleID, dto.NewForumId);
            if (forum_out != null && forum_in != null)
            {
                var perm = false;

                if (forum_out == forum_in)
                {
                    perm = Permissions.HasPerm(forum_out.Security.View, forumUser.UserRoles);
                }
                else
                {
                    perm = Permissions.HasPerm(forum_out.Security.View, forumUser.UserRoles) && Permissions.HasPerm(forum_in.Security.View, forumUser.UserRoles);
                }

                var modSplit = Permissions.HasPerm(forum_out.Security.ModSplit, forumUser.UserRoles);

                if (perm && modSplit)
                {
                    var tc = new TopicsController();

                    int topicId;

                    if (dto.NewTopicId < 1)
                    {
                        var subject = Utilities.CleanString(portalSettings.PortalId, dto.Subject, false, EditorTypes.TEXTBOX, false, false, ActiveModule.ModuleID, string.Empty, false);
                        var replies = dto.Replies.Split('|');
                        var rc = new DotNetNuke.Modules.ActiveForums.DAL2.ReplyController();
                        var firstReply = rc.Get(Convert.ToInt32(replies[0]));
                        var cc = new ContentController();
                        var firstContent = cc.Get(firstReply.ContentId);
                        topicId = tc.Topic_QuickCreate(portalSettings.PortalId, ActiveModule.ModuleID, dto.NewForumId, subject, string.Empty, firstContent.AuthorId, firstContent.AuthorName, true, Request.GetIPAddress());
                        tc.Replies_Split(dto.OldTopicId, topicId, dto.Replies, true);
                    }
                    else
                    {
                        topicId = dto.NewTopicId;
                        tc.Replies_Split(dto.OldTopicId, topicId, dto.Replies, false);
                    }
                }
            }
            return Request.CreateResponse(HttpStatusCode.OK);
        }