NSData data = new NSData(uploadedFile.toURI().toURL());
if (smallData) {
attachment.setSmallData(data);
}
else {
ERAttachmentData attachmentData = ERAttachmentData.createERAttachmentData(editingContext);
attachmentData.setData(data);
attachment.setAttachmentDataRelationship(attachmentData);
}
if (delegate() != null) {
delegate().attachmentAvailable(this, attachment);
}