public override void AfterSave(bool isUpdate) { base.AfterSave(isUpdate); GenericNotification not = new GenericNotification { EntityName = "EntityComment", EntityId = this.Id, RelatedEntityName = EntityName, RelatedEntityId = EntityId }; switch (EntityName) { case "Project": if ((Entity as Project).ManagerId != this.InsertUserId) { not.UserId = (Entity as Project).ManagerId; not.Save(); } break; case "Task": if ((Entity as Task).AssignedToId != this.InsertUserId) { not.UserId = (Entity as Task).AssignedToId; not.Save(); } break; case "Company": if ((Entity as Company).UserId != this.InsertUserId) { not.UserId = (Entity as Company).UserId; not.Save(); } break; case "Contact": if ((Entity as Contact).UserId != this.InsertUserId) { not.UserId = (Entity as Contact).UserId; not.Save(); } break; } }