I try to combine CompletionStages in play framework and then return a Result like ok(). This is my setup:

AccountDao which has two methods:

```
public CompletionStage<Account> getUserByEmail(String email) {
    return supplyAsync(() -> ebeanServer.find(Account.class).setUseCache(true).where().eq(EMAIL, email).findOne(), executionContext).thenApply(account -> {
        return account;
    });
}

public CompletionStage<Void> updateAccount(Account account) throws OptimisticLockException{
    return runAsync(() -> {
        ebeanServer.update(account);
    }, executionContext);
}

```

And then i have my controller with the action:

```
public CompletionStage<Result> editAccount() {
    Map<String, String[]> form_values = request().body().asFormUrlEncoded();
    return CompletableFuture.completedFuture(ok());
}

```

So now in the action i want first to execute getUserByEmail and then i want to set some values and Update this with updateAccount method. How can i combine this two stages without blocking play context? I tried different setups with thenCompose and combine but i dont get it ... 

Here one of my tries:

```
public CompletionStage<Result> editAccount() {
    Map<String, String[]> form_values = request().body().asFormUrlEncoded();
    accountDao.getUserByEmail(session().get("accountEmail")).thenCompose(x -> accountDao.updateAccount(x).thenApplyAsync(account -> {
        return ok("Going to save account edits");
    }, httpExecutionContext.current()));
    return CompletableFuture.completedFuture(ok("Fehler am Ende"));
}

```

The problem here is, that i cannot access the account (x) from before because i cannot set this as function ... like this:

```
public CompletionStage<Result> editAccount() {
    Map<String, String[]> form_values = request().body().asFormUrlEncoded();
    accountDao.getUserByEmail(session().get("accountEmail")).thenCompose(x -> {
        //Update vars in x and then save to database
        accountDao.updateAccount(x);
    }.thenApplyAsync(account -> {
        return ok("Going to save account edits");
    }, httpExecutionContext.current()));
    return CompletableFuture.completedFuture(ok("Fehler am Ende"));
}

```

Here i get the error: The target type of this expression must be a functional interface and plays says that i have to include the return statement at the end of the function!

I just dont get it ... Thanks for your help!

@Marimuthu Madasamy Thats no exactly what i want. In your awnser i would update the account twice. On etime in accountDao.updateAccount(account) and in accountDao.saveAccount(account); I want something like this:

```
return accountDao.getUserByEmail("mail").thenCompose(account -> {
       account.setName("NewName");
       accountDao.save(account);
    } .thenApplyAsync(voidInput -> {
        return ok("Account saved");
    }, httpExecutionContext.current()));

```

In this case in only update the account once and only return the result on the httpExecutionContext