public static ServiceProcessingResult<ValidationResult> ValidateRoleAssignmentFor(ApplicationRole roleBeingAssigned,
            ApplicationRole loggedInUserRole)
        {
            var processingResult = new ServiceProcessingResult<ValidationResult> { IsSuccessful = true };
            var validationResult = new ValidationResult
            {
                IsValid = true
            };

            if (roleBeingAssigned == null)
            {
                validationResult.IsValid = false;
                validationResult.Errors.Add("Invalid role. Please select a valid role and try again.");
            }
            else if (!loggedInUserRole.CanAssign(roleBeingAssigned))
            {
                validationResult.IsValid = false;
                validationResult.Errors.Add(CannotAssignRoleToUserUserHelp);
            }
            processingResult.Data = validationResult;

            return processingResult;
        }
        private async Task<ServiceProcessingResult<ValidationResult>> ValidateModelForLoggedInUserEdit(EditLoggedInUserBindingModel model)
        {
            var processingResult = new ServiceProcessingResult<ValidationResult> { IsSuccessful = true };
            var validationResult = new ValidationResult
            {
                IsValid = true
            };

            if (!ModelState.IsValid)
            {
                validationResult.IsValid = false;
                validationResult.Errors =
                    ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage).ToList();
            }
            else if (model.UserName != LoggedInUserUserName &&
                     await AuthAndUserManager.UserNameAlreadyExists(model.UserName))
            {
                validationResult.IsValid = false;
                validationResult.Errors.Add(UserNameAlreadyExistsUserHelp);
            }
            processingResult.Data = validationResult;

            return processingResult;
        }