public IHttpActionResult SearchPeople([FromUri] FriendSearchModel model)
        {
            var customers = _userService.SearchUsers(model.SearchTerm, model.ExcludeLoggedInUser, model.Page, model.Count);
            var models = new List<object>();

            var currentUser = ApplicationContext.Current.CurrentUser;
            //get all the friends of logged in customer
            IList<Friend> friends = null;
            if (currentUser.IsRegistered())
            {
                friends = _friendService.GetAllCustomerFriends(currentUser.Id);
            }

            if (friends == null)
                friends = new List<Friend>();

            foreach (var c in customers)
            {
                var friendModel = new FriendPublicModel() {
                    Id = c.Id,
                    DisplayName = c.GetPropertyValueAs<string>(PropertyNames.DisplayName),
                    PictureUrl = _pictureService.GetPictureUrl(c.GetPropertyValueAs<int>(PropertyNames.DefaultPictureId)),
                    ProfileUrl =
                        Url.Route("CustomerProfileUrl",
                            new RouteValueDictionary()
                            {
                               { "SeName",  c.GetPermalink().ToString() }
                            }),
                };

                var friend = friends.FirstOrDefault(x => x.FromCustomerId == c.Id || x.ToCustomerId == c.Id);

                if (friend == null)
                    friendModel.FriendStatus = FriendStatus.None;
                else if (friend.Confirmed)
                    friendModel.FriendStatus = FriendStatus.Friends;
                else if (!friend.Confirmed && friend.FromCustomerId == currentUser.Id)
                    friendModel.FriendStatus = FriendStatus.FriendRequestSent;
                else if (currentUser.Id == c.Id)
                    friendModel.FriendStatus = FriendStatus.Self;
                else
                    friendModel.FriendStatus = FriendStatus.NeedsConfirmed;
                models.Add(friendModel);
            }
            return Json(new { Success = true, People = models });
        }
        public IHttpActionResult GetFriendRequests()
        {
            var friendRequests = _friendService.GetCustomerFriendRequests(ApplicationContext.Current.CurrentUser.Id);

            var friendRequestCustomers =
                _customerService.Get(x => friendRequests.Select(r => r.FromCustomerId).ToArray().Contains(x.Id), null);

            var model = new List<FriendPublicModel>();
            foreach (var c in friendRequestCustomers)
            {
                var friendModel = new FriendPublicModel() {
                    Id = c.Id,
                    DisplayName = c.GetPropertyValueAs<string>(PropertyNames.DisplayName),
                    PictureUrl = _pictureService.GetPictureUrl(c.GetPropertyValueAs<int>(PropertyNames.DefaultPictureId)),
                    ProfileUrl = Url.Route("CustomerProfileUrl",
                            new RouteValueDictionary() { {"SeName", c.GetPermalink().ToString() }}),
                    FriendStatus = FriendStatus.NeedsConfirmed
                };
                model.Add(friendModel);

            }

            return Json(new { Success = true, People = model });
        }