public ActionResult Create(string universityId)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            if (!UniversityHelper.IsFromUniversity(GetUserInformatonModel().Details, universityId)) {
                return SendToResultPage(UOMConstants.NOT_APART_OF_UNIVERSITY);
            }

            IDictionary<string, string> myItemTypes = DictionaryHelper.DictionaryWithSelect();

            try {
                myItemTypes = theMarketplaceService.CreateItemTypesDictionaryEntry();
            } catch (Exception myException) {
                LogError(myException, GET_ITEM_TYPES_ERROR);
                ViewData["Message"] = MessageHelper.ErrorMessage(GET_ITEM_TYPES_ERROR);
            }

            try {
                LoggedInWrapperModel<ItemViewModel> myLoggedIn = new LoggedInWrapperModel<ItemViewModel>(GetUserInformatonModel().Details);
                ItemViewModel myCreateItem = new ItemViewModel() {
                    UniversityId = universityId,
                    ItemTypes = new SelectList(myItemTypes, "Value", "Key")
                };
                myLoggedIn.Set(myCreateItem);
                return View("Create", myLoggedIn);
            } catch(Exception myException) {
                LogError(myException, ErrorKeys.ERROR_MESSAGE);
                return SendToErrorPage(ErrorKeys.ERROR_MESSAGE);
            }
        }
        public ActionResult Create(string universityId)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }
            try {
                User myUser = GetUserInformatonModel().Details;

                if (!UniversityHelper.IsFromUniversity(myUser, universityId)) {
                    return SendToResultPage(UOMConstants.NOT_APART_OF_UNIVERSITY);
                }

                CreateClassModel myClassModel = new CreateClassModel() {

                };

                LoggedInWrapperModel<CreateClassModel> myLoggedIn = new LoggedInWrapperModel<CreateClassModel>(myUser);
                myLoggedIn.Set(myClassModel);

                return View("Create", myLoggedIn);
            } catch (Exception myExpcetion) {
                LogError(myExpcetion, CREATE_CLASS_ERROR);
                return SendToErrorPage(CREATE_CLASS_ERROR);
            }
        }
        public ActionResult Edit()
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }
            User myUser = GetUserInformaton();

            EditUserSpecificRegionModel myModel = null;
            ILoggedInModel<EditUserSpecificRegionModel> myLoggedInWrapperModel =
                new LoggedInWrapperModel<EditUserSpecificRegionModel>(myUser, SiteSection.MyProfile);
            try {
                myModel = theService.GetUserSpecificRegionForEdit(myUser);
                myLoggedInWrapperModel.Set(myModel);
            } catch (Exception e) {
                LogError(e, "Unable to get the model to edit the user specific regioin");
                SendToErrorPage("Unable to edit your settings. Please try again.");
            }

            return View("Edit", myLoggedInWrapperModel);
        }
        public ActionResult Edit()
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }
            User myUser = GetUserInformaton();
            Dictionary<string, IEnumerable<Pair<UserProfileQuestion, QuestionAnswer>>> myProfileQuestions =
                new Dictionary<string, IEnumerable<Pair<UserProfileQuestion, QuestionAnswer>>>();
            ILoggedInModel<Dictionary<string, IEnumerable<Pair<UserProfileQuestion, QuestionAnswer>>>> myLoggedInWrapperModel =
                new LoggedInWrapperModel<Dictionary<string, IEnumerable<Pair<UserProfileQuestion, QuestionAnswer>>>>(myUser, SiteSection.MyProfile);
            try {

                myProfileQuestions = theProfileQuestionsService.GetProfileQuestionsGrouped(myUser);
                myLoggedInWrapperModel.Set(myProfileQuestions);
            } catch (Exception e) {
                LogError(e, RETRIEVE_FAIL);
                return SendToErrorPage(RETRIEVE_FAIL);
            }

            return View(EDIT_VIEW, myLoggedInWrapperModel);
        }
        public ActionResult Main(string universityId)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            if (!UniversityHelper.IsFromUniversity(GetUserInformatonModel().Details, universityId)) {
                return SendToResultPage(UOMConstants.NOT_APART_OF_UNIVERSITY);
            }

            try {
                ForceUserInformationRefresh();
                LoggedInWrapperModel<UniversityView> myLoggedInModel = new LoggedInWrapperModel<UniversityView>(GetUserInformatonModel().Details);
                UniversityView myUniveristyView = theUniversityService.GetUniversityProfile(GetUserInformatonModel(), universityId);
                myLoggedInModel.Set(myUniveristyView);
                return View("Main", myLoggedInModel);
            } catch (Exception myException) {
                LogError(myException, UNIVERSITY_PROFILE_ERROR);
                return SendToErrorPage(UNIVERSITY_PROFILE_ERROR);
            }
        }
        public ActionResult List()
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            try {
                UserInformationModel<User> myUserInformation = GetUserInformatonModel();
                IEnumerable<Badge> myBadges = theBadgeService.GetBadgesForUser(myUserInformation.Details);
                LoggedInWrapperModel<SomethingListWithUser<Badge>> myLoggedInModel = new LoggedInWrapperModel<SomethingListWithUser<Badge>>(myUserInformation.Details);
                SomethingListWithUser<Badge> myListedBadges = new SomethingListWithUser<Badge>() {
                    ListedItems = myBadges,
                    TargetUser = myUserInformation.Details
                };
                myLoggedInModel.Set(myListedBadges);
                return View("List", myLoggedInModel);
            } catch (Exception myException) {
                LogError(myException, BADGES_RETRIEVAL_ERROR);
                TempData["Message"] += MessageHelper.ErrorMessage(BADGES_RETRIEVAL_ERROR);
            }

            return RedirectToProfile();
        }
        public ActionResult Edit(string universityId, int id)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            IDictionary<string, string> myItemTypes = DictionaryHelper.DictionaryWithSelect();

            try {
                myItemTypes = theMarketplaceService.CreateItemTypesDictionaryEntry();
            } catch (Exception myException) {
                LogError(myException, GET_ITEM_TYPES_ERROR);
                ViewData["Message"] = MessageHelper.ErrorMessage(GET_ITEM_TYPES_ERROR);
                return RedirectToAction("Details", new { id = id });
            }

            try {
                UserInformationModel<User> myUserInfo = GetUserInformatonModel();
                MarketplaceItem myItem = theMarketplaceService.GetItem(id);

                LoggedInWrapperModel<ItemViewModel> myLoggedIn = new LoggedInWrapperModel<ItemViewModel>(GetUserInformatonModel().Details);
                ItemViewModel myCreateItemModel = new ItemViewModel(myItem) {
                    UniversityId = universityId,
                    ItemTypes = new SelectList(myItemTypes, "Value", "Key", myItem.ItemTypeId)
                };
                myLoggedIn.Set(myCreateItemModel);

                return View("Edit", myLoggedIn);
            } catch (PermissionDenied myException) {
                TempData["Message"] += MessageHelper.WarningMessage(myException.Message);
            } catch (Exception myException) {
                LogError(myException, ErrorKeys.ERROR_MESSAGE);
                TempData["Message"] += MessageHelper.ErrorMessage(ITEM_GET_ERROR);
            }

            return RedirectToAction("Details", new { id = id });
        }
        public ActionResult Details(int id)
        {
            try {
                MarketplaceItem myItem = theMarketplaceService.GetItem(id);
                UserInformationModel<User> myUserInfo = GetUserInformatonModel();
                User myUser = myUserInfo == null ? null : myUserInfo.Details;

                LoggedInWrapperModel<MarketplaceItem> myLoggedIn = new LoggedInWrapperModel<MarketplaceItem>(myUser);
                myLoggedIn.Set(myItem);
                //myLoggedIn.LeftNavigation.BackgroundImage = theUniversityRepo.GetUniversity(myItem.UniversityId).Image;

                return View("Details", myLoggedIn);
            } catch (Exception myException) {
                LogError(myException, ErrorKeys.ERROR_MESSAGE);
                return SendToResultPage(ErrorKeys.ERROR_MESSAGE);
            }
        }
        public ActionResult DetailsWithClassId(string universityId, int classId, ClassViewType classViewType)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }
            if (!UniversityHelper.IsFromUniversity(GetUserInformatonModel().Details, universityId)) {
                return SendToResultPage(UOMConstants.NOT_APART_OF_UNIVERSITY);
            }

            try {
                ClassDetailsModel myClass = theClassService.GetClass(GetUserInformatonModel(), classId, classViewType);
                LoggedInWrapperModel<ClassDetailsModel> myLoggedInModel = new LoggedInWrapperModel<ClassDetailsModel>(GetUserInformatonModel().Details);
                myLoggedInModel.Set(myClass);

                ViewData["ClassViewType"] = classViewType;
                return View("Details", myLoggedInModel);
            } catch (Exception myException) {
                LogError(myException, ErrorKeys.ERROR_MESSAGE);
                return SendToResultPage(ErrorKeys.ERROR_MESSAGE);
            }
        }
        private ActionResult GetEvents(User aViewingUser, int aUserIdOfCalendar)
        {
            User myUserOfCalendar;
            try {
                myUserOfCalendar = theUserRetrievalService.GetUser(aUserIdOfCalendar);
            } catch (Exception e) {
                LogError(e, USER_RETRIEVAL_ERROR);
                return SendToErrorPage(LOAD_EVENTS_ERROR);
            }

            LoggedInWrapperModel<EventViewModel> myLoggedInModel = new LoggedInWrapperModel<EventViewModel>(myUserOfCalendar, aViewingUser, SiteSection.Calendar);
            EventViewModel myModel = new EventViewModel();
            try {
                myModel.Results = theEventService.GetEventsForUser(aViewingUser, aUserIdOfCalendar);
                if (myModel.Results.Count<Event>() == 0) {
                    TempData["Message"] += MessageHelper.NormalMessage(NO_EVENTS);
                }

                myLoggedInModel.Set(myModel);
            } catch (NotFriendException e) {
                SendToErrorPage(HAVConstants.NOT_FRIEND);
            } catch (Exception e) {
                LogError(e, LOAD_EVENTS_ERROR);
                ViewData["Message"] = MessageHelper.ErrorMessage(LOAD_EVENTS_ERROR);
            }

            return View(LIST_VIEW, myLoggedInModel);
        }
        public ActionResult Create(string universityId, string classSubject, string classCourse)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            if (!UniversityHelper.IsFromUniversity(GetUserInformatonModel().Details, universityId)) {
                return SendToResultPage(UOMConstants.NOT_APART_OF_UNIVERSITY);
            }

            IDictionary<string, string> myBookConditionTypes = DictionaryHelper.DictionaryWithSelect();

            try {
                myBookConditionTypes = theTextBookService.CreateTextBookConditionsDictionaryEntry();
            } catch (Exception myException) {
                LogError(myException, GET_TEXTBOOK_CONDITIONS_ERROR);
                ViewData["Message"] = MessageHelper.ErrorMessage(GET_TEXTBOOK_CONDITIONS_ERROR);
            }

            try {
                LoggedInWrapperModel<TextBookViewModel> myLoggedIn = new LoggedInWrapperModel<TextBookViewModel>(GetUserInformatonModel().Details);
                TextBookViewModel myCreateTextbookModel = new TextBookViewModel() {
                    UniversityId = universityId,
                    TextBookConditions = new SelectList(myBookConditionTypes, "Value", "Key"),
                    ClassSubject = classSubject,
                    ClassCourse = classCourse
                };
                myLoggedIn.Set(myCreateTextbookModel);
                return View("Create", myLoggedIn);
            } catch(Exception myException) {
                LogError(myException, ErrorKeys.ERROR_MESSAGE);
                return SendToErrorPage(ErrorKeys.ERROR_MESSAGE);
            }
        }
        public ActionResult Search(string universityId, string searchOption, string searchString, string orderByOption)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            if (!UniversityHelper.IsFromUniversity(GetUserInformatonModel().Details, universityId)) {
                return SendToResultPage(UOMConstants.NOT_APART_OF_UNIVERSITY);
            }

            IEnumerable<TextBook> myTextBooks = new List<TextBook>();

            try {
                LoggedInWrapperModel<TextbookListModel> myLoggedIn = new LoggedInWrapperModel<TextbookListModel>(GetUserInformatonModel().Details);
                myTextBooks = theTextBookService.SearchTextBooksWithinUniversity(universityId, searchOption, searchString, orderByOption);

                TextbookListModel myTextbookListModel = CreateTextBookListModel(myTextBooks, searchOption, orderByOption);

                myLoggedIn.Set(myTextbookListModel);

                if (myTextBooks.Count<TextBook>() == 0) {
                    ViewData["Message"] = MessageHelper.NormalMessage(NO_TEXTBOOKS_SEARCH);
                }

                return View("List", myLoggedIn);
            } catch (Exception myException) {
                LogError(myException, TEXTBOOKS_GET_ERROR);
                return SendToErrorPage(TEXTBOOKS_GET_ERROR);
            }
        }
        public ActionResult Edit(string universityId, int id)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }

            IDictionary<string, string> myBookConditionTypes = DictionaryHelper.DictionaryWithSelect();

            try {
                myBookConditionTypes = theTextBookService.CreateTextBookConditionsDictionaryEntry();
            } catch (Exception myException) {
                LogError(myException, GET_TEXTBOOK_CONDITIONS_ERROR);
                ViewData["Message"] = MessageHelper.ErrorMessage(GET_TEXTBOOK_CONDITIONS_ERROR);
                return RedirectToAction("Details", new { id = id });
            }

            try {
                UserInformationModel<User> myUserInfo = GetUserInformatonModel();
                TextBook myTextBook = theTextBookService.GetTextBookForEdit(myUserInfo, id);

                LoggedInWrapperModel<TextBookViewModel> myLoggedIn = new LoggedInWrapperModel<TextBookViewModel>(GetUserInformatonModel().Details);
                TextBookViewModel myCreateTextbookModel = new TextBookViewModel(myTextBook) {
                    UniversityId = universityId,
                    TextBookConditions = new SelectList(myBookConditionTypes, "Value", "Key", myTextBook.TextBookConditionId)
                };
                myLoggedIn.Set(myCreateTextbookModel);

                return View("Edit", myLoggedIn);
            } catch (PermissionDenied myException) {
                TempData["Message"] += MessageHelper.WarningMessage(myException.Message);
            } catch (Exception myException) {
                LogError(myException, ErrorKeys.ERROR_MESSAGE);
                TempData["Message"] += MessageHelper.ErrorMessage(TEXTBOOK_GET_ERROR);
            }

            return RedirectToAction("Details", new { id = id });
        }
        public ActionResult Details(int id)
        {
            try {
                TextBook myTextBook = theTextBookService.GetTextBook(id);
                UserInformationModel<User> myUserInfo = GetUserInformatonModel();
                User myUser = myUserInfo == null ? null : myUserInfo.Details;

                LoggedInWrapperModel<TextBook> myLoggedIn = new LoggedInWrapperModel<TextBook>(myUser);
                myLoggedIn.Set(myTextBook);
                //myLoggedIn.LeftNavigation.BackgroundImage = myTextBook.University.Image;

                return View("Details", myLoggedIn);
            } catch (Exception myException) {
                LogError(myException, ErrorKeys.ERROR_MESSAGE);
                return SendToResultPage(ErrorKeys.ERROR_MESSAGE);
            }
        }