
374 Mass. 362 (1978)
373 N.E.2d 353
HARNESS TRACKS SECURITY, INC.
vs.
BAY STATE RACEWAY, INC.
Supreme Judicial Court of Massachusetts, Norfolk.
December 8, 1977.
February 14, 1978.
Present: HENNESSEY, C.J., QUIRICO, BRAUCHER, WILKINS, & LIACOS, JJ.
*363 Robert F. Sylvia for the defendant.
Robert W. Kelley, Kevin J. Reddington, & Jeremiah F. Buckley for the plaintiff, submitted a brief.
BRAUCHER, J.
The plaintiff seeks payment for services rendered under a written contract with the defendant. Recovery was denied because the plaintiff had no license under G.L.c. 147, §§ 22-30, to conduct a private detective business in Massachusetts. We agree with the trial judge that the statute was violated, but, applying the criteria laid down in Town Planning & Eng'r Assocs. v. Amesbury Specialty Co., 369 Mass. 737, 745-746 (1976), we hold that recovery is not barred. On analogous principles, we also hold that recovery is not barred by the plaintiff's breach of the contract in failure to obtain a license. We reverse the judgment and remand the case to the Superior Court to determine the amount of the plaintiff's damages.
After a jury waived trial on the issue of illegality, "which was the only issue on liability," a judge of the Superior Court made a memorandum of decision and ordered judgment for the defendant. The plaintiff appealed, and the Justices of the Appeals Court, "being equally divided concerning the plaintiff's right to recover for its services in quantum meruit, in the circumstances of this case," reported the case to this court. We summarize the facts stated in the judge's memorandum of decision.
The plaintiff is organized under the laws of New York as a non-profit corporation, and has held a license as a private investigator under the laws of New York. It has never been licensed to conduct a private detective business in Massachusetts, but on September 21, 1971, it qualified under G.L.c. 181 to do business here. The defendant, a Massachusetts corporation, is engaged in pari mutuel harness racing at Foxborough. The contract in issue was executed on July 29, 1971. It recited that the plaintiff was licensed in *364 New York and in the defendant's State to engage in the business of private investigator. The plaintiff agreed to render investigative, informational, preventive, and supervisory services to the defendant, and the defendant agreed to pay a fee calculated under a formula prescribed in the contract. The contract was to extend through December 31, 1975, but could be terminated at the end of a year by written notice of at least one year.
From the signing of the contract until March 12, 1973, the plaintiff rendered satisfactory services without objection or complaint by the defendant. It furnished reports to the defendant about certain individuals and practices at harness racing tracks in various parts of the country. None of its employees was licensed under G.L.c. 147, §§ 22-30. At least one of the plaintiff's employees, John J. Farrell, visited the Foxborough track from time to time. In August, 1971, the plaintiff made a "vague arrangement" with Northeast Security, Inc., of Brookline (Northeast), a Massachusetts corporation, whereby employees of Northeast performed services for the plaintiff at the Foxborough track. (Although not mentioned in the judge's memorandum, it was undisputed that John J. Farrell was an officer of Northeast.) Northeast was licensed under G.L.c. 147, §§ 22-30, and its resident manager lived in Brookline. The defendant was not aware of the existence of Northeast or of the services rendered by its employees, and it never agreed to any delegation of functions by the plaintiff.
The defendant terminated the contract on March 12, 1973, effective March 31, 1973. There is nothing to indicate that it knew the plaintiff was unlicensed in Massachusetts.
1. Illegality. "No person shall engage in ... private detective business or the business of watch, guard or patrol agency ... unless licensed for such purpose as provided in section twenty-five." G.L.c. 147, § 23.[1] Violation of that statute is punishable by a fine of not more than $1,000 or imprisonment for not more than one year, or both. The *365 plaintiff admitted and the judge found that watch, guard or patrol services were among the services rendered by the plaintiff, and no contention is now made that the plaintiff does not come within the statutory language quoted above.
But § 23 also contains three exceptions on which the plaintiff relied.[2] The judge found and ruled that Northeast was not the plaintiff's representative and that its resident manager was not the resident manager of the plaintiff. Hence the exception for "any corporation, if its resident manager ... or official representative is a licensee," did not apply. The plaintiff does not now argue the contrary, but it continues to assert that the exceptions in § 23, cls. 7 and 9, apply.
We agree with the judge that those exceptions are inapplicable. The exception in § 23, cl. 7, is limited to investigations with respect to, or the compilation or dissemination of, "any data or statistics pertaining to any business or industry." As the judge found, the plaintiff undertook to make investigations of broader scope, including the identification and elimination from harness racing of undesirable persons and practices. Similarly, § 23, cl. 9, excepts the furnishing *366 of "information pertaining to the business and financial standing, credit responsibility or reputation" of certain persons. Again the plaintiff's services were broader; they included supplying agents for track security and maintaining surveillance of activities and personnel.
Thus we conclude that the plaintiff violated § 23.
2. The remedy. The illegality shown is that the plaintiff engaged in private detective business in Massachusetts without a license. The business was carried on through Northeast, a licensee, and employees of Northeast. Those employees were not licensed, but under G.L.c. 147, § 23, employees of a licensee need not be licensed. Under G.L.c. 147, § 28, employment by a licensee is regulated, and there is no showing of noncompliance with § 28. Except for the plaintiff as a corporate entity, there is no showing of disregard of the "distinct legislative concern with the honesty of one engaged in the business of a private detective." Bond v. Commissioner of Pub. Safety, 1 Mass. App. Ct. 536, 540 (1973). The violations of substance shown are the failure to pay the license fee and the failure to post the bond required by G.L.c. 147, § 26. Even those violations could have been avoided by the simple expedient of appointing Northeast as the plaintiff's "official representative" under § 23.
In these circumstances we turn to the factors to be considered and evaluated in determining whether recovery of compensation should be inhibited, as set forth in Town Planning & Eng'r Assocs. v. Amesbury Specialty Co., 369 Mass. 737, 745-746 (1976): "what was the nature of the subject matter of the contract; what was the extent of the illegal behavior; was that behavior a material or only an incidental part of the performance of the contract ...; what was the strength of the public policy underlying the prohibition; how far would effectuation of the policy be defeated by denial of an added sanction; how serious or deserved would be the forfeiture suffered by the plaintiff, how gross or undeserved the defendant's windfall" (footnotes omitted). As in the Town Planning case, we think the vector of considerations here points in the plaintiff's favor. The facts *367 being substantially beyond dispute, the consequence is to be decided as matter of law, and recovery for the services rendered through March 31, 1973, should be allowed in accordance with the terms of the written contract. Id. at 747. It is sufficient sanction that there be no recovery of damages for breach of the executory portion of the contract. See Restatement (Second) of Contracts § 323 (b) & Comment c (Tent. Draft No. 12, 1977).
3. Breach of contract. Even if the plaintiff's recovery is not barred by illegality, the defendant argues, the plaintiff's failure to obtain the required license was a failure to perform a material condition of the contract. This contention may not be properly before us; the judge's statement that illegality was "the only issue on liability" indicates that failure of performance was not asserted at trial. Even if the issue is before us, however, we think it cannot prevail.
We agree that the plaintiff undertook to be properly licensed, and that its failure was sufficiently material to justify the defendant in cancelling the contract. Cf. Clark v. Gulesian, 197 Mass. 492, 494 (1908) (failure to give payment bond). The prospect that the defendant might be liable for the torts of unlicensed personnel sufficiently demonstrates materiality. Cf. Cowan v. Eastern Racing Ass'n, 330 Mass. 135, 142-145 (1953); Hartigan v. Eastern Racing Ass'n, 311 Mass. 368, 370-371 (1942). If it is a fact that the defendant cancelled the contract for some other reason, that fact does not impair the justification. New England Structures, Inc. v. Loranger, 354 Mass. 62, 65-67 (1968). See Restatement (Second) of Contracts § 262 & Comment c (Tent. Draft No. 8, 1973).
But the plaintiff's breach was not so material that the defendant should receive a gift of the plaintiff's services. The rule as to failure of performance is analogous to the rule we apply to the defense of illegality. Compare Buccella v. Schuster, 340 Mass. 323, 325-327 (1960), with Hawes Elec. Co. v. Angell, 332 Mass. 190, 191-192 (1955). See Hayeck Bldg. & Realty Co. v. Turcotte, 361 Mass. 785, 789 (1972); Hathaway v. Cronin, 301 Mass. 419, 421 (1938); Restatement *368 (Second) of Contracts § 226 (c) & Comment d (Tent. Draft No. 8, 1973).
4. Conclusion. The judgment is reversed and the case is remanded to the Superior Court for the determination of the plaintiff's damages in accordance with this opinion.
So ordered.
NOTES
[1]  As amended through St. 1962, c. 361.
[2]  G.L.c. 147, § 23: "The provisions of this section shall not apply to an agent, employee or assistant of a licensee, to any corporation, if its resident manager, superintendent or official representative is a licensee, nor to the following: 

"....
"7. Investigations with respect to, or the compilation or dissemination of, any data or statistics pertaining to any business or industry, by any trade or business association, board or organization, incorporated or unincorporated, not operated for profit, representing persons engaged in such business or industry, or by any agent of any such trade or business association while he is engaged in the discharge of his duties as such agent.
"....
"9. Any trade or business association, board or organization, incorporated or unincorporated, which furnishes as a service to members thereof, information pertaining to the business and financial standing, credit responsibility or reputation of persons with whom such members consider doing business; provided, that an investigation conducted by such association, board, or organization shall be no more extensive than is reasonably required to determine the business and financial standing, credit responsibility or reputation of such person."
