public function create($username, $password, $alias, $appId = null)
    {
        $mandatoryArgs = [
            'username' => $username,
            'password' => $password,
            'alias' => $alias
        ];

        if (ArrayOperations::checkNull($mandatoryArgs)) {
            throw new PlivoValidationException(
                "Mandatory parameters cannot be null");
        }

        $response = $this->client->update(
            $this->uri,
            array_merge($mandatoryArgs, ['app_id' => $appId])
        );
        $responseContents = $response->getContent();
        if(!array_key_exists("error",$responseContents)){

            return new EndpointCreateReponse(
                $responseContents['username'],
                $responseContents['alias'],
                $responseContents['message'],
                $responseContents['endpoint_id'],
                $responseContents['api_id'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }
    }