Copy-paste, copy-paste everywhere! This change reduces the number of places where essentially the same checks were applied in the API code. Change-Id: I0fe6a6bf8757f3fa99308f66f082f899680ad33c