Recently, the increasing availability of renewable energy plants has changed the market of electrical energy. The concept of energy community enables prosumers to exploit and exchange the energy produced locally and reduce the need for external energy sources. This can help to obtain significant cost savings and increase the percentage of green energy. In this paper, we present the Cascade model, which aims to achieve a twofold goal: compute an energy schedule that satisfies the needs of single prosumers, and maximize the energy sharing at the community level, thus minimizing the overall cost. The Cascade model partitions the prosumers in groups: at each step, an optimization problem is solved for all the users of a group. The solution enables defining a super-user that summarizes the energy requirements of the groups considered before. Then, a new group is considered in the next step, and so on, until all the groups have been processed. This approach enables preventing the exponential increase in computing complexity that is inevitable when all the prosumers are considered together, using the model referred to as Unified. Experimental results show that the Cascade model leads to a great reduction of computing time, while the overall cost closely approximates the optimal solution ensured by the Unified model.