Introduce store.writeToLayerStore
Introduce store.writeToLayerStore

... to avoid the repetition of getting, locking,
and reloading, the store.

Use it at least for the simplest writers.

This could be more elegant with Go generics, returning
(T, error), with T possibly being void = struct{}.

Should not change behavior.

Signed-off-by: Miloslav Trmač <9c008e38982a5397deb855345fb164f0558459ae@redhat.com>

containers/storage,containers/storage,containers/storage