I wrote a method that does return sum of decreasing sequence.

For example:
if sequence is 13 9 7 12 13 15, then sum is 29 (13 + 9 + 7).

Now I want to optimize it. Cause the same code is repeating muliple times. But I don't now how. Maybe someone can help me?

```
            int sumMax = 0;

            for (int i = 0; i < array.Length; i++)
            {
                if (i == 0)
                {
                    if (array[i] % 2 == 1)
                    {
                        sum += array[i];

                        if (sumMax < sum)
                        {
                            sumMax = sum;
                        }
                    }
                }
                else
                {
                    if (array[i] % 2 == 0)
                    {
                        sum = 0;
                    }
                    else 
                    {
                        if (sum != 0)
                        {
                            if (array[i - 1] > array[i])
                            {
                                sum += array[i];

                                if (sumMax < sum)
                                {
                                    sumMax = sum;
                                }
                            }
                        }
                        else
                        {
                            sum += array[i];

                            if (sumMax < sum)
                            {
                                sumMax = sum;
                            }
                        }
                    }
                }                
            }

            return sumMax;

```