* @throws Exception
* if a file could not be written
*/
private void writeFiles(final StatusUpdateTemplate template,
final FormItemList items) throws Exception {
FormFile fileItem;
TemplateFileInfo fileInfo;
for (String fileIdentifier : items.getFileIdentifiers()) {
fileItem = items.getFile(fileIdentifier);
fileInfo = template.getFiles().get(fileIdentifier);
if (fileInfo.getContentType().equals(fileItem.getContentType())) {
// write the file and store it within the instantiation item
final File file = this.writeFile(fileItem);
fileItem.setFile(file);
} else {
throw new StatusUpdateInstantiationFailedException("file \""
+ fileIdentifier + "\" must have content type "
+ fileInfo.getContentType());
}