class DocumentsServiceImpl extends AbstractProjectServiceImpl implements DocumentsService {

    @Override
    @Transactional
    public ServiceResult<FileEntryResource> createDocumentFileEntry(long projectId, long documentConfigId, FileEntryResource fileEntryResource, Supplier<InputStream> inputStreamSupplier) {
        return find(getProject(projectId), getCompetitionDocumentConfig(documentConfigId)).
                andOnSuccess((project, projectDocumentConfig) -> validateProjectActive(project)
                        .andOnSuccess(() -> fileService.createFile(fileEntryResource, inputStreamSupplier))
                        .andOnSuccessReturn(fileDetails -> createProjectDocument(project, projectDocumentConfig, fileDetails)));
    }

}