public List <UserStatus> GetUsersGivenGroup(string name, Guid factionId) { var check = _repository.GetAllPresences().Where(presences => presences.Name.Contains(name)).ToList(); var selectedStudents = new List <UserStatus>(); if (check.Count == 0) { foreach (var student in _application.Users.ToList()) { if (student.Group != null && name.Contains(student.Group)) { selectedStudents.Add( _service.CreateAndReturnLatestUser(student.Id, factionId) ); } } } return(selectedStudents); }