i have got two Lists {"Wpisy", "Szczegoly"}
And if I delete record in Wpisy I want to delete all corelate records by days in "Szczegoly", and worker schoud be the same, and Kontrakt schould be the same. In Szczegóły are the list of elements wchich are betwen start date and stop date in Wpisy.

So when I deleting one item from Wpisy, I want to delete all elements in the Szczegóły which are corelate with the Wpisy. Here is my Code. I thin i could lose one loop, which are iterate to the list wpisy. Please help where schould I put this loop.
public override void ItemAttachmentDeleting(SPItemEventProperties properties)
{
base.ItemAttachmentDeleting(properties);
if (properties.List.Title == "Wpisy")
{
SPList mainList = properties.Web.Lists["Wpisy"];
SPList lstOtherList = properties.Web.Lists["Szczegoly"];
// Stworzenie dwóch zmiennych typu data, jednej opisującej dzień Startowy, drugiej opisującej dzień końcowy
DateTime dzienStart = new DateTime();
DateTime dzienStop = new DateTime();
// Podstawienie odpowiednich pól z propetisów pod wcześniej stworzone zmienne
dzienStart = Convert.ToDateTime(properties.AfterProperties["DzienStart"]).ToUniversalTime();
dzienStop = Convert.ToDateTime(properties.AfterProperties["DzienStop"]).ToUniversalTime();
while (dzienStart <= dzienStop)
{
for (int j = 1; j <= lstOtherList.ItemCount; j++)
{
if (Convert.ToDateTime(lstOtherList.Items[j]["Dzien"].ToString()).ToUniversalTime() == dzienStart && lstOtherList.Items[j]["Pracownik"].ToString() == mainList.Items[i]["Pracownik1"].ToString() && lstOtherList.Items[j]["Kontrakt"].ToString() == mainList.Items[i]["Kontrakt1"].ToString())
{
lstOtherList.Items.Delete(j);
}
}
dzienStart = dzienStart.AddDays(1.0);
}
} // Koniec Ifa dotyczącego Listy "Wpisy"
} // Koniec ItemAttachmentDeleting
I don't know that I'm doing good to call by the element: lstOtherList.Items[j]["Pracownik"].ToString()