The law of conservation of matter

Explain the implications of the law of conservation of matter, first law of thermodynamics, and second law of thermodynamics when applied to ecosystems.