If the act or transaction which is claimed to be an offense is lacking in any one material essential element necessary to constitute a crime, then there is no offense, and the failure in this respect is a legal defense. Thus, where the owner of a building arranges with detectives and consents to have his building entered and money taken, for the purpose of entrapping the accused, and succeeds in doing so, there is no burglary or other offense, for the reason the owner consented to have his building entered and money taken. To constitute burglary the act must be committed without the consent and against the will of the owner of the building; and this principle applies to larceny also.18