private String generatePathForAttachment(Resource child, Resource parent)
     throws EndpointNotFoundException {
   Attachment attachment = parent.findAttachment(child.id());
   if (attachment == null) {
     return null;
   }
   Endpoint endpoint = getResourceEndpoint(parent.id());
   ResourceTemplate parentTemplate =
       this.templateManagementService.findTemplateById(parent.id().templateId());
   AttachedTemplate attachedTemplate = parentTemplate.attachedTemplate(attachment.id());
   StringBuilder builder = new StringBuilder();
   addSegment(builder, endpoint.path());
   addSegment(builder, attachedTemplate.path());
   return builder.toString();
 }