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()
     });
 }
        public GroupPhoneDto GetGroupPhone(int UserId, int id)
        {
            var context = new AddressBookContext();
            var user    = context.GetUser(UserId);

            if (user != null)
            {
                var groupPhone = user.GroupPhones.ToList().Find(s => s.Id == id);
                if (groupPhone != null)
                {
                    return(GroupPhoneDto.Get(groupPhone));
                }
            }
            return(null);
        }