public Tuple <bool, long, int> Remove(long id) { bool removedSuccessfull = false; int qtyAssets = 0; // Before be able to remove a person, need to check first if Person has: // one AssetOwner and if there are Assets signed to this AssetOwner. If there are no assets assigned to AssetOwner, // can remove the AssetOwner before remove the Person. // Person can be linkt also to Backup(s), but this are also linked to Assets. So, if there are no Assets linked to this // person, can also not be any Backup. //Will check if exist one AssetOwner for this person, if so it will return the AssetOwnerID, if not it will return 0. long assetOwnwerID = repositoryAssetOwner.AssetOwnerExistPerson(id); if (assetOwnwerID > 0) { //Will check if there are Assets signed to AssetOwner of this Person. qtyAssets = repositoryAsset.QtyAssetsPerAssetOwner(assetOwnwerID); //If there are no Assets signed to this Person (AssetOwner) then can remove the AssetOwner. if (qtyAssets == 0) { repositoryAssetOwner.RemoveAssetOwnerPerson(id); assetOwnwerID = 0; } } //and if no AssetOwner, can remove the Person. if (assetOwnwerID == 0) { repository.Remove(id); removedSuccessfull = true; } // return a message??? If can not remove, why? how many Assets, Backups???? return(new Tuple <bool, long, int>(removedSuccessfull, assetOwnwerID, qtyAssets)); }