class DocumentFieldValueMarshaller extends AbstractFieldValueMarshaller<Document, DocumentData, DocumentFieldDefinition> {

    @Override
    public Document toRawValue(DocumentData documentData) {

        if (documentData == null) {
            return null;
        }

        if (documentData.getStatus().equals(DocumentStatus.STORED)) {
            return originalValue;
        }

        return toDocument(documentData, documentStorage);
    }

    @Inject public  DocumentFieldValueMarshaller(UploadedDocumentStorage documentStorage);

}