public async Task <List <UserClaimModel> > GetAllUserClaims()
        {
            try
            {
                var userScopeClaims = await _userScopeClaimRepository.GetAllUserScopeClaims();

                List <BusinessModels.UserAccessControl.UserClaimModel> userClaimList =
                    new List <BusinessModels.UserAccessControl.UserClaimModel>();

                foreach (var userScopeClaimModel in userScopeClaims)
                {
                    var scopeClaimModel = await _scopeClaimRepository.GetScopeClaimById(userScopeClaimModel.Id);

                    var claimModel = await _claimRepository.GetClaimById(scopeClaimModel.ClaimId);

                    var userClaim = new BusinessModels.UserAccessControl.UserClaimModel(claimModel.Type, null);

                    userClaimList.Add(userClaim);
                }

                return(userClaimList);
            }
            catch (SqlCustomException e)
            {
                throw new SqlCustomException("No User Claims Found.", e.InnerException);
            }
        }
        public async Task <Result <bool> > AddUserClaim(UserClaimModel userClaimModel, string scope, string description)
        {
            // check to see if the desired scope exists
            var dalUserClaims = await _userClaimRepository.GetAllUserClaimsByUserAccountId(userClaimModel.UserAccountId);

            var claimMatch = (dalUserClaims.Where(x => x.Type == userClaimModel.Type).FirstOrDefault());

            if (claimMatch != null)
            {
                return(Result <bool> .Failure(ErrorMessage.UserAlreadyContainsClaim));
            }

            var dalScopes  = (await _scopeRepository.GetAllScopes()).ToList();
            var scopeMatch = dalScopes.Where(x => x.Type == scope).FirstOrDefault();
            int scopeId    = -1;

            if (scopeMatch == null)
            {
                scopeId = await _scopeRepository.CreateScope(new ScopeModel()
                {
                    Type        = scope,
                    Description = description,
                    IsDefault   = false
                });
            }
            else
            {
                scopeId = scopeMatch.Id;
            }

            var claimId = await _userClaimRepository.CreateUserClaim(ModelConverterService.ConvertTo(userClaimModel, new DALUserClaimModel()));

            await _scopeClaimRepository.CreateScopeClaim(new ScopeClaimModel()
            {
                ScopeId = scopeId,
                ClaimId = claimId
            });

            return(Result <bool> .Success(true));
        }