public List <OperationDto> GroupOperations(Common.DTO.SecurityGroupDto group, Common.DTO.SecurityResourceDto resource) { List <OperationDto> lst = new List <OperationDto>(); var roles = this.Repository.Context.RoleToGroups.Where(it => it.GroupId == group.SecurityGroupId).Select(it => it.Role).ToList(); foreach (var role in roles) { var operations = this.Repository.Context.PermissionToRoles.Where(it => it.RoleId == role.RoleId && it.Permission.ResourceId == resource.SecurityResourceId).Select(it => it.Permission.Operation); var operationDtos = OperationRepository.GetDtos(operations); lst.AddRange(operationDtos); } return(lst); }