private void haltIfEntityWithSameIdExists ( ElasticProfile elasticProfile ) { if ( elasticProfileService . findProfile ( elasticProfile . getId ( ) ) == null ) { return ; } elasticProfile . addError ( "id" , format ( "Elastic profile ids should be unique. Elastic profile with id '%s' already exists." , elasticProfile . getId ( ) ) ) ; throw haltBecauseEntityAlreadyExists ( jsonWriter ( elasticProfile ) , "elasticProfile" , elasticProfile . getId ( ) ) ; }
this is done in command as well keeping it here for early return instead of failing later during config update command .