/// <summary>
        /// Assigns an achievement with user content associated with it.
        /// TODO: CHECK THE LOGIC TO MAKE SURE IT ALL WORKS THE WAY IT SHOULD
        /// </summary>
        private void AssignContentSubmissionAchievement(int approvedByID, achievement_user_content_pending pendingContent)
        {
            //Assign the achievement
            var test = AssignAchievement(pendingContent.submitted_by_id, pendingContent.achievement_id, approvedByID);
            //Get the newly assigned achievement
            achievement_instance newInstance = _dbContext.achievement_instance.SingleOrDefault(ai => ai.user_id == pendingContent.submitted_by_id && ai.achievement_id == pendingContent.achievement_id);
            //Create the user content to be added
            achievement_user_content newUserContent = new achievement_user_content()
            {
                approved_by_id = approvedByID,
                approved_date = DateTime.Now,
                content_type = pendingContent.content_type,
                image = pendingContent.content_type == (int)JPPConstants.UserSubmissionTypes.Image ? pendingContent.image : null,
                submitted_date = pendingContent.submitted_date,
                text = pendingContent.text,
                url = pendingContent.content_type == (int)JPPConstants.UserSubmissionTypes.URL ? pendingContent.url : null
            };

            achievement_user_story newuserStory = new achievement_user_story()
            {
                image = pendingContent.content_type == (int)JPPConstants.UserSubmissionTypes.Image ? pendingContent.image : null,
                text = pendingContent.text,
                date_submitted = DateTime.Now
            };

            //Add the new user content to the database
            _dbContext.achievement_user_content.Add(newUserContent);
            _dbContext.achievement_user_story.Add(newuserStory);
            //append the instance to point to the new user content
            newInstance.has_user_content = true;
            newInstance.user_content_id = newUserContent.id;
            newInstance.has_user_story = true;
            newInstance.user_story_id = newuserStory.id;
            //Remove the content from the pending list
            _dbContext.achievement_user_content_pending.Remove(pendingContent);
            //Save changes
            Save();
        }
        private void DenyContentSubmission(achievement_user_content_pending pendingContent, string reason)
        {
            _unitOfWork.SystemRepository.AddNotification(
                pendingContent.submitted_by_id,
                WebSecurity.CurrentUserId,
                "Your submission for the achievement [" + pendingContent.achievement_template.title + "] was denied for the following reason: " + reason,
                pendingContent.achievement_template.icon, new UrlHelper(HttpContext.Current.Request.RequestContext).Action(
                    "IndividualAchievement",
                    "Achievements",
                    new { id = pendingContent.achievement_id }
                ),
                false);

            LoggerModel logSubmissionDeny = new LoggerModel()
            {
                Action = Logger.ManageSubmissionsLogType.DeniedContentSubmission.ToString(),
                UserID = WebSecurity.CurrentUserId,
                IPAddress = HttpContext.Current.Request.UserHostAddress,
                TimeStamp = DateTime.Now,
                ID1 = pendingContent.submitted_by_id,
                IDType1 = Logger.LogIDType.User.ToString(),
                ID2 = pendingContent.achievement_id,
                IDType2 = Logger.LogIDType.AchievementTemplate.ToString(),
                Value1 = reason
            };

            Logger.LogSingleEntry(logSubmissionDeny, _dbContext);

            _dbContext.achievement_user_content_pending.Remove(pendingContent);

            Save();
        }
        public Boolean UserSubmittedContentForURL(int achievementID, int userID, String text, String url)
        {
            achievement_template achievementTemplate = _dbContext.achievement_template.Find(achievementID);

            if (achievementTemplate == null)
                return false;
            if (achievementTemplate.content_type == null || achievementTemplate.content_type != (int)JPPConstants.UserSubmissionTypes.URL)
                return false;
            if (_dbContext.achievement_instance.Any(ai => ai.achievement_id == achievementID && ai.user_id == userID) || _dbContext.achievement_user_content_pending.Any(aucp => aucp.achievement_id == achievementID && aucp.submitted_by_id == userID))
                return false;

            achievement_user_content_pending newUserContentPending = new achievement_user_content_pending()
            {
                achievement_id = achievementID,
                content_type = (int)JPPConstants.UserSubmissionTypes.URL,
                submitted_by_id = userID,
                submitted_date = DateTime.Now,
                text = text,
                url = url
            };

            _dbContext.achievement_user_content_pending.Add(newUserContentPending);
            Save();
            return true;
        }