public ActionResult SetAdvisorCobrandView(AdvisorCobrandInfoViewModel options)
        {
            var cobrandedSiteNameErrors = ValidateCobrandedSiteName(options);
            var cobrandedLogoErrors     = ValidateCustomLogo(options);
            var returnValue             = "";

            if (ModelState.IsValid && cobrandedSiteNameErrors.IsNullOrEmpty() && cobrandedLogoErrors.IsNullOrEmpty())
            {
                var savedOk = AdvisorCobrandAndSettingsManager.SaveCobrandedInfo(options.AdvisorCobrandInfo, FederatedLoginClient.User.UserMasterEntityId);
                return(new HttpStatusCodeResult(savedOk ? HttpStatusCode.OK : HttpStatusCode.InternalServerError));
            }
            // REVIEW: this is a non-standard way to handle validation errors. Ripe for refactoring as time permits.
            // We should set up validation attributes in the incoming model,
            // and rely upon Html.ValidationMessage's in the cshtml template, injecting error text into the markup.
            cobrandedSiteNameErrors.ForEach(error => ModelState["options.CobrandedSiteName"].Errors.Add(error));
            cobrandedLogoErrors.ForEach(error => ModelState["options.LogoData"].Errors.Add(error));

            // validation error -- round-trip the incoming model w/ the validation error list injected
            options.SavedStatus = returnValue;

            // need to refresh a few dictionaries which are not posted to this method, since they are critical to the UI
            var candidatesAndEditors = CobrandingManager.GetCandidatesAndEditors(options.AdvisorCompanyMeid, options.SelectedPrivateLabelEditorIds);

            options.PrivateLabelEditorCandidates = candidatesAndEditors.Item1;
            options.SelectedPrivateLabelEditors  = candidatesAndEditors.Item2;

            var view = PartialView(options.AdvisorSettingsPartial, options);

            Response.StatusCode = (int)HttpStatusCode.PartialContent;
            return(view);
        }
 private static List <string> ValidateCobrandedSiteName(AdvisorCobrandInfoViewModel options)
 {
     return(CobrandingManager.ValidateCobrandedSiteName(options.AdvisorID, options.CobrandedSiteName, options.PrivateLabelType, options.PrivateLabelUrlType));
 }