List<RegistrationItem> getRegistrationsByUser(List<RegistrationItem> registrations, User user) {
   List<RegistrationItem> result = new ArrayList<RegistrationItem>();
   for (RegistrationItem registration : registrations) {
     if (SipUri.extractUser(registration.getUri()).equals(user.getUserName())) {
       result.add(registration);
     }
   }
   return result;
 }
 List<RegistrationItem> getRegistrations(List<Map<String, ?>> registrations) {
   List<RegistrationItem> items = new ArrayList<RegistrationItem>(registrations.size());
   for (Map<String, ?> r : registrations) {
     RegistrationItem item = new RegistrationItem();
     item.setContact((String) r.get("contact"));
     item.setPrimary((String) r.get("primary"));
     item.setExpires((Integer) r.get("expires"));
     item.setUri((String) r.get("uri"));
     item.setInstrument((String) r.get("instrument"));
     items.add(item);
   }
   return items;
 }