class DeploymentConfigurationDao {

    @SneakyThrows
    public <T extends AbstractDeploymentConfig> T findById(Class<T> clazz, String id) {
        Path path = localGitRepositoryPathResolver.resolve(clazz, id);
        T config = null;
        if (Files.exists(path)) {
            byte[] bytes = Files.readAllBytes(path);

            if (ArrayUtils.isNotEmpty(bytes)) {
                config = YamlParserUtil.parse(new String(bytes, StandardCharsets.UTF_8), clazz);
            }
        } else {
            // Any data to migrate?
            config = alienDao.findById(clazz, id);
            if (config != null) {
                // migrating data from ES to Git
                save(config);
                alienDao.delete(clazz, id);
            }
        }
        return config;
    }

    @Inject public  DeploymentConfigurationDao(LocalGitRepositoryPathResolver localGitRepositoryPathResolver, @Named("alien-es-dao") IGenericSearchDAO alienDao);

}