public void Save(UserGroupRoleVeiwModel userGroupVeiwModel)
        {
            UserGroupRoles usergroup = new UserGroupRoles(userGroupVeiwModel.Id)
            {
                 UserGroup=_userGroupRepository.GetById(userGroupVeiwModel.GroupId),
                 UserRole = userGroupVeiwModel.RoleId

            };
            _userGroupRolesRepository.Save(usergroup);
        }
        private UserGroupRoleVeiwModel Map(UserGroupRoles userGroupRole)
        {
            UserGroupRoleVeiwModel vm = new UserGroupRoleVeiwModel
            {
                GroupId = userGroupRole.UserGroup.Id,
                GroupName=userGroupRole.UserGroup.Name,
                RoleId=(int)userGroupRole.UserRole,
                RoleName=userGroupRole.UserRole.ToString(),
                Id = userGroupRole.Id,
                IsActive = userGroupRole._Status == EntityStatus.Active ? true : false
            };
            return vm;

        }
        public void Save(string[] roles, Guid groupId)
        {
            List<UserGroupRoleVeiwModel> vwRoles = new List<UserGroupRoleVeiwModel>();
            if (roles != null)
            {
                for (int i = 0; i < roles.Length; i++)
                {
                    UserGroupRoleVeiwModel cpvmmoto = new UserGroupRoleVeiwModel();
                    string[] s = roles[i].ToString().Split(',');
                    string UserGroupRoleId = s[0];
                    
                    string RoleId = s[1];

                    cpvmmoto.GroupId =groupId;
                    cpvmmoto.Id = Guid.Parse(UserGroupRoleId);
                    cpvmmoto.RoleId = int.Parse(RoleId);
                    vwRoles.Add(cpvmmoto);
                }
                foreach (UserGroupRoles rolesitem in _userGroupRolesRepository.GetByGroup(groupId))
                {
                    if (vwRoles.Any(p => p.RoleId == (int) rolesitem.UserRole && p.GroupId == rolesitem.UserGroup.Id))
                    {
                        rolesitem.CanAccess = true;
                    }
                    else
                    {
                        rolesitem.CanAccess = false;
                    }
                    _userGroupRolesRepository.Save(rolesitem);
                }
            }

        }