To entitle any party to foreclose by advertisement, it shall be necessary that the mortgage containing such power of sale has been duly recorded and, if it shall have been assigned, that all the assignments thereof have been duly recorded in the county where such mortgaged premises are situated.
SDCL 21-48-2