class MessageTypeDaoHelper {

    public MessageTypeEntity getMessageTypeEntity(String code)
    {
        MessageTypeEntity messageTypeEntity = messageTypeDao.getMessageTypeByCode(code);

        if (messageTypeEntity == null)
        {
            throw new ObjectNotFoundException(String.format("Message type with code \"%s\" doesn't exist.", code));
        }

        return messageTypeEntity;
    }

}