public function validateEntity($entity)
{
parent::validateEntity($entity);
if (!empty(Entity\FarmRoleScalingMetric::findOne([['farmRoleId' => $entity->farmRoleId], ['id' => ['$ne' => $entity->id]]]))) {
throw new ApiErrorException(409, ErrorMessage::ERR_UNICITY_VIOLATION, 'DateAndTime metric cannot be used with others');
}
if ($entity->settings->count() === 0) {
throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_STRUCTURE, 'Missed property schedule');
}
}