private void GetAllFamiliesInDepartmentFromService(string departmentName)
        {
            try
            {
                List <CACCCheckInDb.PeopleWithDepartmentAndClassView> people = null;

                logger.Debug("Retrieving GetAllFamiliesInDepartment from CACCCheckInService");

                using (CACCCheckInServiceProxy proxy =
                           new CACCCheckInServiceProxy())
                {
                    proxy.Open();

                    people = proxy.GetAllFamiliesInDepartment(departmentName);
                }

                List <Family> families = new List <Family>();

                // Group all the people into families based on FamilyId
                IEnumerable <IGrouping <Guid?, CACCCheckInDb.PeopleWithDepartmentAndClassView> > familyGroups =
                    people.GroupBy(r => r.FamilyId);

                // Loop through all the family groups and build a List of Family
                foreach (IGrouping <Guid?, CACCCheckInDb.PeopleWithDepartmentAndClassView> familyGroup in familyGroups)
                {
                    if (!familyGroup.Key.HasValue)
                    {
                        continue;
                    }

                    Family family = new Family();
                    family.Id = familyGroup.Key.Value;

                    // Loop through all family members in current family group
                    foreach (CACCCheckInDb.PeopleWithDepartmentAndClassView familyMember in familyGroup)
                    {
                        // We will base the family name on LastName of adult in certain roles.
                        if (!String.IsNullOrWhiteSpace(family.Name) &&
                            (familyMember.FamilyRole.Equals("Adult") ||
                             familyMember.FamilyRole.Equals("Mother") ||
                             familyMember.FamilyRole.Equals("Father") ||
                             familyMember.FamilyRole.Equals("HeadOfHousehold")))
                        {
                            family.Name = familyMember.LastName;
                        }

                        family.Members.Add(familyMember);
                    }

                    // If we didn't get a family name for some reason from adults in family
                    // we will just base it on LastName of first person in the family group
                    if (String.IsNullOrWhiteSpace(family.Name))
                    {
                        family.Name = familyGroup.First().LastName;
                    }

                    families.Add(family);
                }

                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.Send,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.FamiliesDataContext = families;
                    return(null);
                }), null);
            }
            catch (Exception ex)
            {
                Debug.Assert(View != null);
                View.ViewDispatcher.BeginInvoke(DispatcherPriority.DataBind,
                                                new DispatcherOperationCallback(
                                                    delegate(object arg)
                {
                    View.DisplayExceptionDetail(ex);
                    return(null);
                }), null);
            }
        }