public void AppsOnDerive(ObjectOnDerive method) { var derivation = method.Derivation; if (this.ExistCustomer && this.ExistSalesRepresentative) { Party tempQualifier = this.Customer; tempQualifier.RemoveCurrentSalesReps(); foreach (SalesRepRelationship salesRepRelationship in tempQualifier.SalesRepRelationshipsWhereCustomer) { if (salesRepRelationship.FromDate <= DateTime.UtcNow && (!salesRepRelationship.ExistThroughDate || salesRepRelationship.ThroughDate >= DateTime.UtcNow)) { tempQualifier.AddCurrentSalesRep(salesRepRelationship.SalesRepresentative); } } this.SalesRepresentative.OnDerive(x => x.WithDerivation(derivation)); } this.Parties = new[] { this.Customer }; if (!this.ExistCustomer | !this.ExistSalesRepresentative) { this.Delete(); } }