public GroupAddressDto GetGroupAddress(int UserId, int id)
        {
            var context = new AddressBookContext();
            var user    = context.GetUser(UserId);

            if (user != null)
            {
                var groupAddress = user.GroupAddresses.ToList().Find(s => s.Id == id);
                if (groupAddress != null)
                {
                    return(GroupAddressDto.Get(groupAddress));
                }
            }
            return(null);
        }
 public static UserDto Get(User user)
 {
     return(new UserDto()
     {
         Id = user.Id,
         Login = user.Login,
         Password = user.Password,
         Subscriber = (IEnumerable <Subscriber>)user.Subscribers.Select(a => SubscriberDto.Get(a)).ToList(),
         GroupAddress = (IEnumerable <GroupAddress>)user.GroupAddresses.Select(a => GroupAddressDto.Get(a)).ToList(),
         GroupPhone = (IEnumerable <GroupPhone>)user.GroupPhones.Select(a => GroupPhoneDto.Get(a)).ToList(),
         Group = (IEnumerable <Group>)user.Groups.Select(a => GroupDto.Get(a)).ToList()
     });
 }