private IList <IdentityRoleViewModel> GetRoleViewModels(ApplicationUser user = null)
        {
            IList <IdentityRoleViewModel> roleViewModels;

            if (user == null)
            {
                var allRoles = _rolesRepository.Get();
                roleViewModels = (
                    from IdentityRole identityRole in allRoles
                    select new IdentityRoleViewModel
                {
                    RoleId = identityRole.Id,
                    RoleName = identityRole.Name,
                }).ToList();
            }
            else
            {
                var allRoles  = _rolesRepository.Get().ToList();
                var userRoles = user.UserRoles;

                roleViewModels = (
                    from IdentityRole identityRole in allRoles
                    select new IdentityRoleViewModel
                {
                    RoleId = identityRole.Id,
                    RoleName = identityRole.Name,
                    HasRole = userRoles.Select(x => x.Id).Contains(identityRole.Id)
                }).ToList();
            }

            return(roleViewModels);
        }