Here is a comprehensive guide for both scenarios.