public IEnumerable<FamilyUser> GetFamilyOfUser(User user)
        {
            Request.CityApiRequest req = new Request.CityApiRequest();
            var familyResults = req.ExecuteGetRequestAndParse(_parentSession, string.Format("/users/{0}/family", user.ID));

            List<FamilyUser> familyUsers = new List<FamilyUser>();

            dynamic famMembers = familyResults["family_members"];

            foreach (var famMember in famMembers)
            {
                string famRole = famMember.family_role;
                double userId = famMember.user_id;

                familyUsers.Add(new FamilyUser() { FamilyRole = famRole, User = GetUserByID(Convert.ToInt32(userId)) });
            }

            return familyUsers;
        }
        public User GetUserByID(int userId)
        {
            if (_cache.IsCached<User>())
            {
                var cachedUsers = _cache.GetCachedItems<User>();
                var targetUser = cachedUsers.FirstOrDefault(g => g.ID == userId);

                if (targetUser != null) { return targetUser; }
            }

            if (_individualUserCache.ContainsKey(userId))
            {
                return _individualUserCache[userId];
            }

            Request.CityApiRequest req = new Request.CityApiRequest();
            var response = req.ExecuteGetRequestAndParse(_parentSession, string.Format("/users/{0}?include_custom_fields=true", userId));

            var u = new User(response);

            _individualUserCache[u.ID] = u;

            return u;
        }
 public IEnumerable<FamilyUser> GetParentsInFamilyOfUser(User user)
 {
     var familyUsers = GetFamilyOfUser(user);
     return familyUsers.Where(f => f.FamilyRole.ToUpperInvariant().Contains("CHILD") == false).ToList();
 }
 public IEnumerable<FamilyUser> GetChildrenInFamilyOfUser(User user)
 {
     var familyUsers = GetFamilyOfUser(user);
     return familyUsers.Where(f => f.FamilyRole.ToUpperInvariant() == "CHILD").ToList();
 }