private function removeCloudLocationEntityByIdIfExists($id) { $cl = CloudLocation::findPk($id); /* @var $cl \Scalr\Model\Entity\CloudLocation */ if ($cl instanceof CloudLocation) { //Removes previously created location $cl->delete(); } }