Some performance fixes and code cleanup

## Dashboard loading
### At start:
Completed 200 OK in 11054ms (Views: 1083.8ms | ActiveRecord: 9961.3ms)

### After model methods update
``` sql
Project Load (7615.8ms)  SELECT "projects".* FROM "projects" WHERE "projects"."id" IN (2803, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2134, 2136, 2138, 2139, 2140, 2141, 2142, 2144, 2145, 2147, 2148, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2167, 2169, 2170, 2171, 2172, 2174, 2176, 2177, 2178, 2179, 2180, 2182, 2183, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2202, 2203, 2207, 2208, 2209, 2210, 2211, 2213, 2214, 2217, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2250, 2255, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2270, 2272, 2273, 2274, 2275, 2277, 2278, 2279, 2281, 2282, 2283, 2284, 2285, 2287, 2289, 2291, 2292, 2294, 2296, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2306, 2308, 2309, 2310, 2315, 2316, 2318, 2320, 2321, 2322, 2326, 2329, 2330, 2331, 2332, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2344, 2345, 2346, 2348, 2352, 2354, 2355, 2356, 2357, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2371, 2376, 2384, 2385, 2387, 2389, 2390, 2392, 2393, 2395, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2406, 2407, 2410, 2412, 2413, 2415, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2425, 2426, 2427, 2429, 2430, 2431, 2435, 2436, 2438, 2439, 2440, 2441, 2443, 2444, 2445, 2447, 2448, 2450, 2451, 2454, 2455, 2456, 2457, 2458, 2460, 2461, 2462, 2467, 2468, 2472, 2474, 2477, 2478, 2481, 2483, 2485, 2486, 2492, 2493, 2496, 2497, 2500, 2501, 2502, 2504, 2505, 2506, 2507, 2508, 2510, 2511, 2515, 2516, 2517, 2518, 2520, 2523, 2524, 2525, 2526, 2528, 2529, 2530, 2532, 2536, 2537, 2539, 2546, 2550, 2554, 2560, 2562, 2563, 2564, 2565, 2567, 2569, 2570, 2571, 2572, 2574, 2576, 2577, 2578, 2585, 2589, 2590, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2602, 2603, 2604, 2605, 2607, 2611, 2618, 2619, 2620, 2628, 2629, 2630, 2635, 2637, 2648, 2652, 2656, 2658, 2659, 2661, 2662, 2663, 2668, 2669, 2673, 2674, 2686, 2689, 2695, 2706, 2708, 2709, 2711, 2713, 2714, 2715, 2720, 2721, 2723, 2724, 2725, 2726, 2727, 2728, 2730, 2732, 2733, 2734, 2735, 2736, 2738, 2758, 2759, 2762, 2763, 2765, 2766, 2768, 2769, 2773, 2774, 2776, 2777, 2778, 2779, 2780, 2784, 2788, 2791, 2792, 2793, 2796, 2799, 2801, 2805) ORDER BY (SELECT max(old_events.created_at) FROM old_events WHERE old_events.project_id = projects.id) DESC LIMIT 20
```
Completed 200 OK in 8360ms (Views: 678.5ms | ActiveRecord: 7657.2ms)

### After all PR
``` sql
Project Load (1.1ms)  SELECT "projects".* FROM "projects" WHERE "projects"."id" IN (2803, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2134, 2136, 2138, 2139, 2140, 2141, 2142, 2144, 2145, 2147, 2148, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2167, 2169, 2170, 2171, 2172, 2174, 2176, 2177, 2178, 2179, 2180, 2182, 2183, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2202, 2203, 2207, 2208, 2209, 2210, 2211, 2213, 2214, 2217, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2250, 2255, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2270, 2272, 2273, 2274, 2275, 2277, 2278, 2279, 2281, 2282, 2283, 2284, 2285, 2287, 2289, 2291, 2292, 2294, 2296, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2306, 2308, 2309, 2310, 2315, 2316, 2318, 2320, 2321, 2322, 2326, 2329, 2330, 2331, 2332, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2344, 2345, 2346, 2348, 2352, 2354, 2355, 2356, 2357, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2371, 2376, 2384, 2385, 2387, 2389, 2390, 2392, 2393, 2395, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2406, 2407, 2410, 2412, 2413, 2415, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2425, 2426, 2427, 2429, 2430, 2431, 2435, 2436, 2438, 2439, 2440, 2441, 2443, 2444, 2445, 2447, 2448, 2450, 2451, 2454, 2455, 2456, 2457, 2458, 2460, 2461, 2462, 2467, 2468, 2472, 2474, 2477, 2478, 2481, 2483, 2485, 2486, 2492, 2493, 2496, 2497, 2500, 2501, 2502, 2504, 2505, 2506, 2507, 2508, 2510, 2511, 2515, 2516, 2517, 2518, 2520, 2523, 2524, 2525, 2526, 2528, 2529, 2530, 2532, 2536, 2537, 2539, 2546, 2550, 2554, 2560, 2562, 2563, 2564, 2565, 2567, 2569, 2570, 2571, 2572, 2574, 2576, 2577, 2578, 2585, 2589, 2590, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2602, 2603, 2604, 2605, 2607, 2611, 2618, 2619, 2620, 2628, 2629, 2630, 2635, 2637, 2648, 2652, 2656, 2658, 2659, 2661, 2662, 2663, 2668, 2669, 2673, 2674, 2686, 2689, 2695, 2706, 2708, 2709, 2711, 2713, 2714, 2715, 2720, 2721, 2723, 2724, 2725, 2726, 2727, 2728, 2730, 2732, 2733, 2734, 2735, 2736, 2738, 2758, 2759, 2762, 2763, 2765, 2766, 2768, 2769, 2773, 2774, 2776, 2777, 2778, 2779, 2780, 2784, 2788, 2791, 2792, 2793, 2796, 2799, 2801, 2805) ORDER BY last_activity_at DESC LIMIT 20
```
Completed 200 OK in 2112ms (Views: 1339.7ms | ActiveRecord: 42.1ms)